Re: can't instantiate following inner class

2006-12-28 Thread Gian Mario Tagliaretti
Gabriel Genellina wrote: > >>> class One(object): pass > ... > >>> a = One(1,2) > Traceback (most recent call last): >File "", line 1, in ? > TypeError: default __new__ takes no parameters > > How do you make Python silently ignore the arguments? sorry, my bad, that beauvoir was python 2.2

Re: can't instantiate following inner class

2006-12-27 Thread Gabriel Genellina
At Wednesday 27/12/2006 23:55, Gian Mario Tagliaretti wrote: 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 ig

Re: can't instantiate following inner class

2006-12-27 Thread Gian Mario Tagliaretti
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 wou

Re: can't instantiate following inner class

2006-12-27 Thread buffi
Pyenos wrote: > class One: > Two() #can't instantiate > class Two: > Three() #can't instantiate > class Three:pass Python parses code from top to bottom. Since it first tries to read the class One and finds the class Two inside it, it throws an error since it is not defined yet. R

Re: can't instantiate following inner class

2006-12-27 Thread Larry Bates
Pyenos wrote: > class One: > Two() #can't instantiate > class Two: > Three() #can't instantiate > class Three:pass > > > You keep posting examples with the same problems that others have addressed. It appears you are trying to write Python in a way that some "other" language wor

can't instantiate following inner class

2006-12-27 Thread Pyenos
class One: Two() #can't instantiate class Two: Three() #can't instantiate class Three:pass -- http://mail.python.org/mailman/listinfo/python-list