Python 3K or Python 2.9?

Duncan Booth duncan.booth at invalid.invalid
Fri Sep 14 14:16:30 CEST 2007


Piet van Oostrum <piet at cs.uu.nl> wrote:

>>>>>> Ben Finney <bignose+hates-spam at benfinney.id.au> (BF) wrote:
> 
>>BF> The latter two statements are equivalent. The
>>'instance.method(args)' BF> syntax is just sugar for
>>'Class.method(instance, args)'. 
> 
> It is more than just syntactic sugar because the Class is derived from
> the instance at runtime. 

Other differences that mean it isn't just sugar:

you can save the bound method created by 'instance.method' but not with the 
expanded version.

The equivalence depends on the type of 'method', other expansions are 
possible: e.g. Class.method(Class, args) or Class.method(args) or invent 
your own.



More information about the Python-list mailing list