Is there a stylistic taboo or other flaw for implementing trivial methods by assigning class attributes? For instance. for example, bar and baz lower, in contrast to the more significant foo .
class MyClass(object): def hello(self): return 'hello' def foo(self): return self.hello() bar = lambda self: self.hello() baz = hello
I am tempted by the obvious savings of such things:
__str__ = __repr__ = hello
source share