Problem subclassing tuple

Aahz aahz at
Tue Apr 29 18:22:14 CEST 2003

In article <mailman.1051631814.18940.python-list at>,
John Wilson <tug at> wrote:
>class Holder(tuple):
>    def __init__(self, *values):
>        tuple.__init__(self, values)
>When I try to create an instance:
>Holder(1, 2)
>I get:
>TypeError: tuple() takes at most 1 argument (2 given)

Use __new__ instead of __init__.
Aahz (aahz at           <*>

"In many ways, it's a dull language, borrowing solid old concepts from
many other languages & styles:  boring syntax, unsurprising semantics,
few automatic coercions, etc etc.  But that's one of the things I like
about it."  --Tim Peters on Python, 16 Sep 93

More information about the Python-list mailing list