converting base class instance to derived class instance
François Pinard
pinard at iro.umontreal.ca
Mon Feb 9 15:27:40 EST 2004
[John Roth]
> > If you want to do a little bit of deep magic, a factory function can
> > create an instance by calling object(), [...] My goof. The correct
> > call is: object.__new__(klas) [...]
OK, thanks. `object.__new__' is what I was using already. It was
looking kosher to me because of the explanations in `descrintro'. Maybe
I was seduced and tempted by the announced bit of deep magic, and was
trying to rediscover the secret. My little Harry Potter side! :-)
--
François Pinard http://www.iro.umontreal.ca/~pinard
More information about the Python-list
mailing list