Did you know, that you can also define methods in Python this way?

def pr(*args):
print("i got %r" % args)

class Foo:
bar = pr

>>> Foo().bar()
i got <__main__.Foo object at 0x7f6b8b4ed950>

@Wolf480pl I used to monkey-patch classes this way.

def thing_that_wasnt_there(self):
# do something with the class

Class.new_thing = thing_that_wasnt_there


@Wolf480pl (But then I grow up and did things the proper way :D)

Sign in to participate in the conversation
Functional Café

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!