<div class="gmail_quote">On Thu, Oct 22, 2009 at 8:12 PM, rh0dium <span dir="ltr"><<a href="mailto:steven.klass@gmail.com">steven.klass@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

In my case the args that it dumps them into a black hold is simply not<br>
true.  I want an unknown set of args and kwargs to simply be forwarded<br>
onto init.  So what's the problem with this??<br></blockquote><div><br></div><div>There is no problem with doing that-- the deprecation warning is just that object.__new__ takes no arguments besides the class itself. </div>

<div><br></div><div>Within __new__ you do not need to do anything to "forward" the arguments to __init__. Python calls first __new__, then __init__ with the arguments you pass. You don't have to forward from one method to another.</div>

<div><br></div><div>Observe:</div><div><br></div><div><div><div>>>> class myclass(object):</div><div>...     def __new__(cls, *args, **kwargs):</div><div>...             print args</div><div>...             print kwargs</div>

<div>...             self = object.__new__(cls)</div><div>...             return self</div><div>...     def __init__(self, *args, **kwargs):</div><div>...             print args</div><div>...             print kwargs</div>

<div>... </div><div>>>> A = a()</div><div>()</div><div>{}</div><div>()</div><div>{}</div><div>>>> A = a(1,2,3)</div><div>(1, 2, 3)</div><div>{}</div><div>(1, 2, 3)</div><div>{}</div><div><br></div><div>
HTH,</div>
<div><br></div><div>--S</div></div></div></div>