Any ideas about the best work around for __new__ losing its arguments?
<p>So, I only realised today that <code>__new__</code> is deprecated for receiving arguments, as of python 2.6 (it isn't mentioned in the documentation, which is also not true in terms of the behavior of <code>__new__</code> calling <code>__init__</code> as far as I can see). This means my functional code has started raising warnings, and I want to rid myself of them. But I can't see an elegant way to work around.</p>

<p>I have a bunch of classes that perform optimizations when they are constructed. So I have</p>

<pre><code>class Conjunction(Base):
    def __new__(cls, a, b):
       if a == True: 
          return b
       elif b == True
          return a
       else:
          return super(Conjunction,cls).__new__(cls, a, b)
</code></pre>

<p>And so on (real versions cover lots more cases). So unlike what Guido says in <a href="http://mail.python.org/pipermail/python-dev/2008-February/076854.html" rel="nofollow">this response</a> (the only reference to it I can find), my <code>__new__</code> method <em>does</em> use its arguments, and <em>cannot</em> be replaced by an overridden <code>__init__</code> function.</p>

<p>The best I can do is to split this in two:</p>

<pre><code>def Conjunction(a, b):
   if a == True: 
      return b
   elif b == True
      return a
   else:
      return ConjunctionImpl(a, b)

class ConjunctionImpl(Base):
   # ...
</code></pre>

<p>But that is plain ugly and stinks to high heaven. Am I missing an elegant way to have a class constructor return some arbitrary object based on the constructor parameters it is given?</p>
