can't instantiate following inner class
Gabriel Genellina
gagsl-py at yahoo.com.ar
Wed Dec 27 21:25:44 EST 2006
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 ignore them and you probably won't like it...
I don't understand what you say here.
>>> class One(object): pass
...
>>> a = One(1,2)
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?
--
Gabriel Genellina
Softlab SRL
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas
More information about the Python-list
mailing list