classes and list as parameter, whats wrong?

Terry Reedy tjreedy at udel.edu
Fri Aug 26 23:07:18 CEST 2005


"Dirk Zimmermann" <python-list at d1z1.de> wrote in message 
news:20050826111532.GD23815 at hep.physik.uni-siegen.de...
> But still, it is not absolutely clear for me, what is going on. So, at
> least just for my understanding: The parameter LL is created just once
> for the whole class and not for the object (because I del the object
> explicitly, which should destroy the object)?

Default parameter values are created (once) for the function, not for the 
class or instance.  Function default parameter expressions are evaluated 
once and only once when the function is defined.  Code that you want 
evaluated with each call goes in the function body.

Terry J. Reedy






More information about the Python-list mailing list