Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #18010

Re: confused about __new__

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 <fredrik@dolda2000.com>
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 <fredrik@dolda2000.com>
To python-list@python.org
Subject Re: confused about __new__
In-Reply-To <MPbKq.47607$cN1.25052@newsfe12.iad>
References <MPbKq.47607$cN1.25052@newsfe12.iad>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4125.1324964928.27778.python-list@python.org> (permalink)
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

Show key headers only | View raw


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 (<http://docs.python.org/reference/datamodel.html>) 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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

confused about __new__ "K. Richard Pixley" <rich@noir.com> - 2011-12-26 20:28 -0800
  Re: confused about __new__ Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-27 04:53 +0000
    Re: confused about __new__ K Richard Pixley <rich@noir.com> - 2011-12-26 21:27 -0800
  Re: confused about __new__ Fredrik Tolf <fredrik@dolda2000.com> - 2011-12-27 06:48 +0100
    Re: confused about __new__ K Richard Pixley <rich@noir.com> - 2011-12-27 09:41 -0800
      Re: confused about __new__ Ian Kelly <ian.g.kelly@gmail.com> - 2011-12-27 11:28 -0700
      Re: confused about __new__ Ian Kelly <ian.g.kelly@gmail.com> - 2011-12-27 13:34 -0700
        Re: confused about __new__ K Richard Pixley <rich@noir.com> - 2011-12-27 14:19 -0800
          Re: confused about __new__ Ian Kelly <ian.g.kelly@gmail.com> - 2011-12-27 15:43 -0700
      Re: confused about __new__ K Richard Pixley <rich@noir.com> - 2011-12-27 12:31 -0800
  Re: confused about __new__ Ian Kelly <ian.g.kelly@gmail.com> - 2011-12-27 00:28 -0700
  Re: confused about __new__ Lie Ryan <lie.1296@gmail.com> - 2011-12-27 18:47 +1100
  Re: confused about __new__ Fredrik Tolf <fredrik@dolda2000.com> - 2011-12-27 19:05 +0100

csiph-web