OO and game design questions

Jean-Michel Pichavant jeanmichel at sequans.com
Mon Oct 18 06:13:16 EDT 2010


dex wrote:
>  In each object's
> __init__() that object is added to game_object list, and in each
> __del__() they are removed from game_object list. This mechanism keeps
> them safe from garbage collector. How pythonic is this design?
>   
You don't have to manage memory with python, I don't know if you wrote 
C++ in the past (looks like) but consider that python is taking care of 
everything and you'll be fine.

So do not override __del__ (anyway it is not called as you may expect it).


Keep a game_object list only if you need the game to know wich objects 
are in the game, not to keep references.

JM



More information about the Python-list mailing list