Barnaby Scott wrote:
I am working on a script at the moment, in which I seem to need to
re-initialise a class instance from within some of its methods. Before I go
too much further down this route - could anyone comment on whether the call
self.__init__() is in itself considered bad style or 'unpythonic'?

For instance, is it better to create a 'reset' method, which is called both
by __init__ and by the methods which are wanting to force a
re-initialisation?

Personally I would make a reset() method, the intent is clearer and it is less prone to breakage if for some reason you change __init__ later.


Kent

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to