__init__ function problem
babui
jmgimeno at gmail.com
Tue Nov 7 09:57:08 EST 2006
Steven D'Aprano ha escrit:
> Once the __new__ method creates the instance and returns, before anything
> else happens, the instance's __init__ method is called.
This only happens when the object created by __new__ isinstance of the
class invoked in the creation statement, that is:
s=MagicStr("lala")
executes:
s = MagicStr.__new__(MagicStr, "lala")
if isinstance(s, MagicStr):
type(s).__init__(s, "lala")
--
Juan M. Gimeno
More information about the Python-list
mailing list