P
Pyenos
class One:
Two() #can't instantiate
class Two:
Three() #can't instantiate
class Threeass
Two() #can't instantiate
class Two:
Three() #can't instantiate
class Threeass
You keep posting examples with the same problemsPyenos said:class One:
Two() #can't instantiate
class Two:
Three() #can't instantiate
class Threeass
Pyenos said:class One:
Two() #can't instantiate
class Two:
Three() #can't instantiate
class Threeass
At said: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...
Larry said: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
Gabriel said:Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: default __new__ takes no parameters
How do you make Python silently ignore the arguments?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.