|
|
|
|
|
by grot
5298 days ago
|
|
Also, i forgot to add, your code snippet doesn't work. Some magic goes into the self binding. In [21]: def hello(self):
....: print self.name
....:
In [22]: class Foo(object):
....: name = 'blah'
....:
In [23]: goo = Foo()
go
In [24]: goo.hi = hello
In [25]: goo.hi
Out[25]: <function hello at 0x103985aa0>
In [26]: goo.hi()
TypeError Traceback (most recent call last)
TypeError: hello() takes exactly 1 argument (0 given)
|
|