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


Groups > comp.lang.python > #18010

Re: confused about __new__

Date 2011-12-27 06:48 +0100
From Fredrik Tolf <fredrik@dolda2000.com>
Subject Re: confused about __new__
References <MPbKq.47607$cN1.25052@newsfe12.iad>
Newsgroups comp.lang.python
Message-ID <mailman.4125.1324964928.27778.python-list@python.org> (permalink)

Show all headers | 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