variables of the class are not available as default values?

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Fri Aug 28 10:51:43 CEST 2009


Chris Rebert a écrit :
(snip)

> Default values are only evaluated once, when the class is defined,

<clarification target="newcomers">

s/class/function/

The function objects (defined in a class statement body...) are created 
before the class object itself.

</clarification>

> thus "self" is not defined at that point since the class is still
> being defined when the method definition is executed and thus there
> can be no instances yet anyway.



More information about the Python-list mailing list