compare object to empty tuple with the 'is' operator in Python 2.x
<p>I'm used to seeing <code>if obj is None:</code> in Python, and I've recently come across  <code>if obj is ():</code>. Since tuples are not mutable, it sounds like a reasonable internal optimization in the Python interpreter to have the empty tuple be a singleton, therefore allowing the use of <code>is</code> rather than requiring <code>==</code>. But is this guaranteed somewhere? Since which version of the interpreter?</p>

<p>[edit] the question matters because if () is not a singleton and there is a way of producing an empty tuple with a different address, then using <code>is {}</code> is a bug. If it is only guaranteed since Python 2.x with x > 0, then it is important to know the value of x if you need to ensure backward compatibility of your code. It is also important to know if this can break your code when using pypy / jython / ironpython...</p>
