Open this example in the interactive library
Source code
from functools import partialmethod
class Robot:
def turn(self, degrees):
return f'Turn {degrees} degrees'
turn_left = partialmethod(turn, -90)
print(Robot().turn_left())Sample output
Turn -90 degrees
