can't instantiate following inner class
Gian Mario Tagliaretti
g.tagliaretti at gmail.com
Wed Dec 27 21:55:55 EST 2006
Larry Bates wrote:
> Proper way is:
>
> class One:
> def __init__(self):
> self.Two=Two()
>
> Of course Two must be a proper class definition also.
>
> class Two:
> def __init__(self):
> self.Three=Three()
>
> class Three:
> pass
just as a side note probably it would be better to use new style classes in
newly written code:
class One(object):
def __init__(self):
whatever
don't forget to call __init__ on new style classes otherwise you can pass
arbitrary arguments when instantiating the class e.g.:
one = One(a, b)
but python will silently ignore them and you probably won't like it...
cheers
--
Gian Mario Tagliaretti
More information about the Python-list
mailing list