difference between class methods and instance methods

John john_sips_teaz at yahooz.com
Thu Feb 17 11:35:06 EST 2005


Diez B. Roggisch wrote:
> 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. So
> only at construction time. Creating them means taking the unbound method
> and binding the created object as first argument to the method. Thus each
> instance of a class Foo with a method bar has its own instance of bar - the
> bound method bar. But only one per object. 
> 
> 

Ohhhhhhhh. Unlike C++, where methods are not first class objects
and you only have *one* that gets shared by all instances.

I'm getting it. Thanks for the reply. :)

---J

-- 
--- remove zees if replying via email ---



More information about the Python-list mailing list