overriding a tuple's __init__
Simon Burton
simonb at webone.com.au
Mon Aug 18 03:37:45 EDT 2003
Python 2.2.2 (#2, Nov 24 2002, 11:41:06)
[GCC 3.2 20020903 (Red Hat Linux 8.0 3.2-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class pair(tuple):
... def __init__(self,a,b):
... tuple.__init__(self, (a,b) )
...
>>> a=pair(1,2)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: tuple() takes at most 1 argument (2 given)
>>>
What gives? (yes it works with a list, but i need immutable/hashable)
Simon Burton.
More information about the Python-list
mailing list