[Tutor] __init__ for class instantiation?

Alan Gauld alan.gauld@blueyonder.co.uk
Fri Apr 25 20:44:02 2003


> My best current solution is to do just that. I can do it via
__init__, but
> this means the function I want to run once upon the class's
definition is
> actually called with every instance of the class. But I'm not going
to
> stress about the CPU cycles caused by this :)

One other thought. Create a singleton class(ACtionList?) to hold the
actions then assign that to a member of your Thing class... Pass it
into
Thing as a default init parameter even. Then every Thing type object
has a reference to the single instance of ActionList.

Just a thought.

Alan G.