subclassing tuple

Jeff Epler jepler at unpythonic.net
Tue Sep 17 22:59:40 CEST 2002


On Tue, Sep 17, 2002 at 08:05:02PM +0000, Douglas Zongker wrote:
> Is there any way to create a subclass of 'tuple' that has a customized
> constructor?  I tried doing the obvious thing, but it doesn't work --
> it seems the tuple initializer gets called *before* the one for my
> subclass.  This:

You must override __new__.  See the "docs".

http://www.python.org/2.2/descrintro.html

Jeff




More information about the Python-list mailing list