Re: confused about __new__



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

.



Relevant Pages

  • Re: Finding installed package files
    ... for making installation information more easily accessible? ... >> somewhere where more information about the key parts of the package ... >> As an example I installed the latest Python on Fedora 3. ... what one would expect is a form of help documentation much more integrated ...
    (alt.os.linux.redhat)
  • Re: Do you feel bad because of the Python docs?
    ... "The Python documentation is bad, ... It is valuable to contrast and compare the PHP and Python docs: ... One of the problems with "fixing" the Python reference docs ...
    (comp.lang.python)
  • Re: Bitching about the documentation...
    ... > a language need complaints about the language? ... To give potential adopters of Python a more even handed view ... but sometimes "constructive criticism" means ... I have found Python's documentation to generally be excellent. ...
    (comp.lang.python)
  • Re: My Python annoyances
    ... incomplete documentation, a maze of little platform-specific quirks to ... Python base classes have changed behavior. ... perhaps the best introduction to the language when it was written. ... I filed a bug report. ...
    (comp.lang.python)
  • Re: My Python annoyances
    ... incomplete documentation, a maze of little platform-specific quirks to ... Python base classes have changed behavior. ... perhaps the best introduction to the language when it was written. ... I filed a bug report. ...
    (comp.lang.python)