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?

References <2a4ea789-1661-4515-89c2-4259efd186a6@googlegroups.com>
Date 2014-05-18 17:18 +1000
Subject Re: Why should __prepare__ be explicitly decorated as a @classmethod?
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.10110.1400397511.18130.python-list@python.org> (permalink)

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