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


Groups > comp.lang.python > #71727

Re: Why should __prepare__ be explicitly decorated as a @classmethod?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.043
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; 'static': 0.04; 'method,': 0.09; 'subject:Why': 0.09; 'cc:addr:python-list': 0.11; 'question.': 0.14; '__new__': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'rules.': 0.16; 'language': 0.16; 'wrote:': 0.18; 'fit': 0.20; 'cc:addr:python.org': 0.22; "aren't": 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'such.': 0.31; 'class': 0.32; 'url:python': 0.33; 'cases': 0.33; 'received:google.com': 0.35; 'method': 0.36; 'subject:?': 0.36; 'similar': 0.36; 'url:org': 0.36; 'pm,': 0.38; 'enough': 0.39; 'break': 0.61; 'url:3': 0.61; 'more': 0.64; 'special': 0.74; '4:26': 0.84; 'brain,': 0.84; 'url:datamodel': 0.84; 'url:reference': 0.84; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type:content-transfer-encoding; bh=qaG7L1FuPZYo02u6im59j7xAedZ+ehJilBfEedrWCZs=; b=cF53NLOUtBeGEsdMmLHHEgwGmBXV8vZ4gK7XQXMPTPfUhIiqbWaSECKmJdA5VqxPu7 LdbWS7qIQwMwMG5rENdpbz3OCaWlUGOc+fH8nG97Qw09DIVcwB986/IkB8Z4lrHHTONV u3ITBe05+MxAXZeJbyVa2QE0iAIBX0+IFh8meNc8IqIbOxlEYq5XaU1zcBRkxxvwvNou w9vJMhyQ0cFOpNcL4r0vp3aY/ue0tM1qUDk21exr3/dcASr1nPr44rF59XqFCAnoeHTa 0+pXWnJqXur8GROT9MVXnHzUprB2Jh+Q6qjSPC2lZYidv6t71sbX5Z3TrEzdO+eaNlYW 9M/g==
MIME-Version 1.0
X-Received by 10.220.191.134 with SMTP id dm6mr7106203vcb.16.1400397502682; Sun, 18 May 2014 00:18:22 -0700 (PDT)
In-Reply-To <2a4ea789-1661-4515-89c2-4259efd186a6@googlegroups.com>
References <2a4ea789-1661-4515-89c2-4259efd186a6@googlegroups.com>
Date Sun, 18 May 2014 17:18:22 +1000
Subject Re: Why should __prepare__ be explicitly decorated as a @classmethod?
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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.10110.1400397511.18130.python-list@python.org> (permalink)
Lines 13
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1400397511 news.xs4all.nl 2940 [2001:888:2000:d::a6]:33852
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:71727

Show key headers only | View raw


On Sun, May 18, 2014 at 4:26 PM, Shriramana Sharma <samjnaa@gmail.com> wrote:
> https://docs.python.org/3/reference/datamodel.html#basic-customization documents that __new__ is special-cased so that while it is actually a static method, it need not be decorated as such. I have a similar question. IIUC __prepare__ is always a class method to be used in metaclasses, so why isn't it also special-cased so that it need not be decorated as a such?

Special cases aren't special enough to break the rules. The less
special cases a language has, the more likely it is to fit inside your
brain, and that's a good thing.

ChrisA

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


Thread

Why should __prepare__ be explicitly decorated as a @classmethod? Shriramana Sharma <samjnaa@gmail.com> - 2014-05-17 23:26 -0700
  Re: Why should __prepare__ be explicitly decorated as a @classmethod? Chris Angelico <rosuav@gmail.com> - 2014-05-18 17:18 +1000

csiph-web