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


Groups > comp.lang.python > #71726

Why should __prepare__ be explicitly decorated as a @classmethod?

Newsgroups comp.lang.python
Date 2014-05-17 23:26 -0700
Message-ID <2a4ea789-1661-4515-89c2-4259efd186a6@googlegroups.com> (permalink)
Subject Why should __prepare__ be explicitly decorated as a @classmethod?
From Shriramana Sharma <samjnaa@gmail.com>

Show all headers | View raw


Hello. I did search for this but couldn't find the info anywhere else, so I'm asking here. Please point out if I've missed some other source of the same info:

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?

Thanks.

Back to comp.lang.python | Previous | NextNext 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