title: How to initialize an instance of a subclass of tuple in Python?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1565374/subclassing-python-tuple-with-multiple-init-arguments">Subclassing Python tuple with multiple __init__ arguments</a>  </p>
  </blockquote>
  
  
  
  <p>I want to define a class which inherits from <code>tuple</code>, and I want to be able to instantiate it using a syntax not supported by <code>tuple</code>. For a simple example, let's say I want to define a class <code>MyTuple</code> which inherits from <code>tuple</code>, and which I can instantiate by passing two values, <code>x</code> and <code>y</code>, to create the (my) tuple <code>(x, y)</code>. I've tried the following code:</p>
  
  <pre><code>class MyTuple(tuple):
      def __init__(self, x, y):
          print("debug message")
          super().__init__((x, y))
  </code></pre>
  
  <p>But when I tried, for example, <code>MyTuple(2, 3)</code> I got an error: <code>TypeError: tuple() takes at most 1 argument (2 given)</code>. It seems my <code>__init__</code> function was not even called (based on the error I got and on the fact my "debug message" was not printed).</p>
  
  <p>So what's the right way to do this?</p>
  
  <p>I'm using Python 3.2.</p>