Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news-transit.tcx.org.uk!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.024 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'context': 0.04; 'instance,': 0.05; 'python': 0.08; 'things.': 0.12; 'method.': 0.15; 'bound;': 0.16; 'explanation': 0.16; 'instantiate': 0.16; 'methods,': 0.16; 'mon,': 0.16; 'wrote:': 0.18; "haven't": 0.20; 'detect': 0.21; 'dec': 0.22; 'header:In-Reply-To:1': 0.22; 'static': 0.24; 'says': 0.25; "i'm": 0.26; 'bit': 0.28; 'class': 0.29; 'confused': 0.30; 'anyone': 0.31; 'does': 0.32; 'wondering': 0.32; 'header:User-Agent:1': 0.33; 'there': 0.33; 'object': 0.33; 'to:addr:python-list': 0.34; 'it.': 0.34; 'someone': 0.34; 'richard': 0.34; 'things': 0.34; 'calling': 0.34; 'url:python': 0.36; 'explain': 0.36; 'properties': 0.36; 'charset:us-ascii': 0.37; 'bound': 0.37; 'skip:" 10': 0.37; 'but': 0.37; 'spread': 0.37; 'could': 0.37; 'several': 0.38; 'couple': 0.38; 'created': 0.38; 'url:docs': 0.39; "i'd": 0.39; 'url:org': 0.39; 'should': 0.39; 'to:addr:python.org': 0.40; 'type': 0.61; 'all;': 0.84; 'fredrik': 0.84; 'url:datamodel': 0.84; 'url:reference': 0.84; 'about,': 0.91 Date: Tue, 27 Dec 2011 06:48:45 +0100 (CET) From: Fredrik Tolf To: python-list@python.org Subject: Re: confused about __new__ In-Reply-To: References: User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.3.7 (nerv.dolda2000.com [IPv6:2002:54d9:e3a5:200::1]); Tue, 27 Dec 2011 06:48:45 +0100 (CET) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1324964928 news.xs4all.nl 6932 [2001:888:2000:d::a6]:41771 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:18010 On Mon, 26 Dec 2011, K. Richard Pixley wrote: > I don't understand. Can anyone explain? I'm also a bit confused about __new__. I'd very much appreciate it if someone could explain the following aspects of it: * The manual () says that __new__ is "a static method (special-cased so you need not declare it as such)". What does "special-cased" mean? Apparently, for instance, in OP's case, Python did not automatically detect that it should not be bound as a method. * Is there any part of the manual that explains, holistically, the greater context of object instantiation into which __new__ fits? I can only find small parts of it spread around the documentation for __new__ and __init__, but no complete explanation of it. There are several things I'm wondering about, like what it means to call a type object at all; how methods, properties and the like are bound; how pickle can instantiate a class without calling __init__; when and whether __dict__ is created and a couple of other things. Is there a complete documentation of the process anywhere that I haven't managed to find? -- Fredrik Tolf