Problems subclassing tuple instead of list

Christos TZOTZIOY Georgiou DLNXPEGFQVEB at spammotel.com
Mon Feb 10 11:56:10 CET 2003


On Sun, 9 Feb 2003 03:00:51 +0100, rumours say that holger krekel
<pyth at devel.trillke.net> might have written:

>Maybe it has to do with the immutability
>of tuples.

This is the problem, which I had when I created a subclass of tuple
allowing named access to its members (a la structtype).  By the time
your __init__ is called, the tuple has been created.  So for immutable
types, __new__ must be overloaded.
-- 
TZOTZIOY, I speak England very best,
Real email address: 'dHpvdEBzaWwtdGVjLmdy\n'.decode('base64')




More information about the Python-list mailing list