Problem subclassing tuple

John Wilson tug at
Tue Apr 29 17:55:21 CEST 2003

Given this class:

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)

It looks like the constructor for the superclass is being called rather than
the __init__ method on Holder.

I'm obviously missing something here. Do I have to supply a __new__ method?
Any help would be appreciated.

John Wilson
The Wilson Partnership

More information about the Python-list mailing list