Class Encapsulation Errors in Python 2.3.3

Duncan Booth duncan.booth at invalid.invalid
Fri Nov 19 11:44:56 CET 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