Basic Class/Instance Question
Alan Franzoni
alan.franzoni_invalid at geemail.invalid
Wed May 23 12:31:52 EDT 2007
Il 23 May 2007 04:53:55 -0700, Siah ha scritto:
[cut]
No.
It's because the *body* of the function gets evaluated every time the
function is called, while the *definition* of the function gets evaluated
just once, when the function is 'declared'.
Your issue arises when the default value of the function (which is part of
the definition, not of the body) is a mutable object, because it's the very
same default value that gets modified at each time.
--
Alan Franzoni <alan.franzoni.xyz at gmail.com>
-
Togli .xyz dalla mia email per contattarmi.
Remove .xyz from my address in order to contact me.
-
GPG Key Fingerprint (Key ID = FE068F3E):
5C77 9DC3 BD5B 3A28 E7BC 921A 0255 42AA FE06 8F3E
More information about the Python-list
mailing list