Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #71726 > unrolled thread
| Started by | Shriramana Sharma <samjnaa@gmail.com> |
|---|---|
| First post | 2014-05-17 23:26 -0700 |
| Last post | 2014-05-18 17:18 +1000 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
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
| From | Shriramana Sharma <samjnaa@gmail.com> |
|---|---|
| Date | 2014-05-17 23:26 -0700 |
| Subject | Why should __prepare__ be explicitly decorated as a @classmethod? |
| Message-ID | <2a4ea789-1661-4515-89c2-4259efd186a6@googlegroups.com> |
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.
[toc] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-05-18 17:18 +1000 |
| Message-ID | <mailman.10110.1400397511.18130.python-list@python.org> |
| In reply to | #71726 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web