A change to a class attribute does not propagate - bug or feature?
Alex Martelli
aleax at aleax.it
Fri Jan 11 11:45:17 EST 2002
"Greg Goodman" <chironsw at swbell.net> wrote in message
news:3C3EFE65.B4DC6E34 at swbell.net...
>
> The default value of the Name parameter gets evaluated exactly once, the
Yes.
> first time the newClass.__init__() code is executed. Ever afterward,
No, the "only once" happens earlier than that -- when the *def* for
that __init__ is executed, which is earlier than the first time its
*code* is executed. Just a nit, if you will, but potentially important.
[code being talked about is:]
> > class newClass(baseClass):
> > def __init__(self, Name = "newClass" + str(baseClass.ClassId)):
> > baseClass.__init__(self, Name)class newClass(baseClass):
Alex
More information about the Python-list
mailing list