On Fri, 04 Nov 2005 13:52:22 -0800, Paul Rubin wrote: > Steven D'Aprano <[EMAIL PROTECTED]> 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.
It might be bogus to you, but it isn't to me. I prefer to delay setting instance attributes until they are needed. It also allows you to do something like this: class ExpertGame(Game): current_level = 100 and then use ExpertGame anywhere you would have used Game with no problems. Yes, there are other ways to do this. I won't say they are wrong, but I don't believe they are better. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list