Re: Python 2.6 Deprecation Warnings with __new__ — Can someone explain why?

Stephen Hansen apt.shansen at gmail.com
Fri Oct 23 06:10:36 CEST 2009


On Thu, Oct 22, 2009 at 9:09 PM, Stephen Hansen <apt.shansen at gmail.com>wrote:

> >>> class myclass(object):
> ...     def __new__(cls, *args, **kwargs):
> ...             print args
> ...             print kwargs
> ...             self = object.__new__(cls)
> ...             return self
> ...     def __init__(self, *args, **kwargs):
> ...             print args
> ...             print kwargs
> ...
> >>> A = a()
> ()
> {}
> ()
> {}
> >>> A = a(1,2,3)
> (1, 2, 3)
> {}
> (1, 2, 3)
> {}
>
>
Sigh, as I try to correct stupid in-interactive-interpreter demonstration
code's really bad naming scheme in email but do it half-assed; obviously
those calls are supposed to be like "a = myclass()" and "a =
myclass(1,2,3)"

HTH,
>
> --S
>



-- 
Stephen Hansen
Development
Advanced Prepress Technology

shansen at advpubtech.com
(818) 748-9282
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091022/9ab61627/attachment.html>


More information about the Python-list mailing list