Class Variable Access and Assignment

Paul Rubin http
Fri Nov 4 16:52:22 EST 2005


Steven D'Aprano <steve at REMOVETHIScyber.com.au> writes:
> Follow the logical implications of this proposed behaviour.
> 
> class Game:
>     current_level = 1
>     # by default, games start at level one  

That's bogus.  Initialize the current level in the __init__ method
where it belongs.



More information about the Python-list mailing list