Spot the different between x and y?

>>> x = MyClass()
>>> x.f()
‘hello world’
>>> y = MyClass
>>> y.f()
Traceback (most recent call last):
File “<pyshell#3>”, line 1, in <module>
y.f()
TypeError: unbound method f() must be called with MyClass instance as first argument (got nothing instead)
>>>

Advertisements

~ by nambabwe on 2010/04/07.

 
%d bloggers like this: