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


Groups > comp.lang.python > #93776

Foo.__new__ is what species of method?

Path csiph.com!usenet.pasdenom.info!news.albasani.net!news.roellig-ltd.de!open-news-network.org!border2.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.064
X-Spam-Evidence '*H*': 0.88; '*S*': 0.00; 'receives': 0.03; 'static': 0.03; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:method': 0.09; 'bug': 0.10; 'python': 0.10; 'argument.': 0.16; 'method::': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'all,': 0.20; 'implicit': 0.22; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'subject:what': 0.29; 'says': 0.32; 'class': 0.33; 'url:python': 0.33; 'instance': 0.35; 'but': 0.36; 'should': 0.36; 'instead': 0.36; 'url:org': 0.36; 'url:library': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'method': 0.37; 'say': 0.37; 'received:org': 0.37; 'skip:o 20': 0.38; 'does': 0.39; 'takes': 0.39; 'to:addr:python.org': 0.40; 'called': 0.40; 'url:3': 0.60; 'your': 0.60; 'elsewhere': 0.66; 'japan': 0.66; 'warm': 0.67; 'skip:\xe2 10': 0.70; 'receive': 0.71; '8bit%:43': 0.72; '8bit%:46': 0.76; '_o__)': 0.84; 'received:125': 0.84; 'url:datamodel': 0.84; 'url:functions': 0.84; 'url:html#object': 0.84; 'url:reference': 0.91; 'room,': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Ben Finney <ben+python@benfinney.id.au>
Subject Foo.__new__ is what species of method?
Date Tue, 14 Jul 2015 14:45:25 +1000
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host jigong.madmonks.org
X-Public-Key-ID 0xAC128405
X-Public-Key-Fingerprint 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405
X-Public-Key-URL http://www.benfinney.id.au/contact/bfinney-pubkey.asc
X-Post-From Ben Finney <bignose+hates-spam@benfinney.id.au>
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)
Cancel-Lock sha1:m1ZN4/4bayzEyT7MPbBjwcRSoaY=
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.478.1436849134.3674.python-list@python.org> (permalink)
Lines 29
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1436849134 news.xs4all.nl 2929 [2001:888:2000:d::a6]:57089
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:93776

Show key headers only | View raw


Howdy all,

The Python reference says of a class ‘__new__’ method::

    object.__new__(cls[, ...])

    Called to create a new instance of class cls. __new__() is a static
    method (special-cased so you need not declare it as such) that takes
    the class of which an instance was requested as its first argument.

    <URL:https://docs.python.org/3/reference/datamodel.html#object.__new__>

But a “static method” is described, elsewhere in the documentation
<URL:https://docs.python.org/3/library/functions.html#staticmethod>, as
“A static method does not receive an implicit first argument”.

What the ‘__new__’ documentation describes would match a “class method”
<URL:https://docs.python.org/3/library/functions.html#classmethod>
“A class method receives the class as implicit first argument”.

I suspect this a bug in the reference documentation for ‘__new__’, and
it should instead say “__new__ is a class method …”. Am I wrong?

-- 
 \        “Cooles & Heates: If you want just condition of warm in your |
  `\    room, please control yourself.” —air conditioner instructions, |
_o__)                                                            Japan |
Ben Finney

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


Thread

Foo.__new__ is what species of method? Ben Finney <ben+python@benfinney.id.au> - 2015-07-14 14:45 +1000
  Re: Foo.__new__ is what species of method? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-07-14 14:54 +1000
    Re: Foo.__new__ is what species of method? Ben Finney <ben+python@benfinney.id.au> - 2015-07-14 15:17 +1000
    Re: Foo.__new__ is what species of method? Stefan Behnel <stefan_ml@behnel.de> - 2015-07-14 08:26 +0200

csiph-web