Class Encapsulation Errors in Python 2.3.3

Duncan Booth duncan.booth at invalid.invalid
Fri Nov 19 05:44:56 EST 2004


Jeff Shannon wrote:

> The problem here is that default values in functions/methods are 
> evaluated at *compile* time.

Actually, no. The default values in functions/methods are evaluated when 
the def statement is *executed* not when anything is compiled. If you 
execute the def multiple times the default values are recalculated each 
time. 



More information about the Python-list mailing list