difference between class methods and instance methods
Antoon Pardon
apardon at forel.vub.ac.be
Fri Feb 18 03:00:07 EST 2005
Op 2005-02-17, Diez B. Roggisch schreef <deetsNOSPAM at web.de>:
> John wrote:
>> ... hmm... bound methods get created each time you make
>> a call to an instance method via an instance of the given class?
>
> No, they get created when you create an actual instance of an object.
I'm not so sure about that. Take the following code:
>>> class A:
... def m():
... pass
...
>>> a = A()
>>> u = a.m
>>> u is a.m
False
If bound methods were created at instance creation one would expect
a True result here instead of False.
--
Antoon Pardon
More information about the Python-list
mailing list