promoting [] by superclass?

Tor Iver Wilhelmsen tor.iver.wilhelmsen at
Tue Jun 8 22:39:50 CEST 2004

Jim Newton <jimka at> writes:

> class x1(list):
>    def __init__(y):
>       pass

You lack a "self" argument there for it to be a real initializer.

> what does x1([]) do and what does x2([]) do?

>>> x = x1([])
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: __init__() takes exactly 1 argument (2 given)

x2([]) works though, since it uses the __init__ in list.

More information about the Python-list mailing list