A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2012-June/119876.html below:

[Python-Dev] Language reference updated for metaclasses

[Python-Dev] Language reference updated for metaclassesPJ Eby pje at telecommunity.com
Mon Jun 4 23:52:13 CEST 2012
On Sun, May 20, 2012 at 4:38 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:

> When writing the docs for types.new_class(), I discovered that the
> description of the class creation process in the language reference
> was not only hard to follow, it was actually *incorrect* when it came
> to describing the algorithm for determining the correct metaclass.
>
> I rewrote the offending section of the language reference to both
> describe the correct algorithm, and hopefully also to be easier to
> read. Once people have had a chance to review the changes in the 3.3
> docs, I'll backport the update to 3.2.
>
> Previous docs:
> http://docs.python.org/py3k/reference/datamodel.html#customizing-class-creation
> Updated docs:
> http://docs.python.org/dev/reference/datamodel.html#customizing-class-creation
>

This is only sort-of-related, but while reviewing the above, the bit about
__class__ caught my eye and brought this question to mind: how do class
decorators interact with __class__?  Specifically, what happens (or more to
the point, is *supposed* to happen and documented as such) if a class
decorator returns a different class object?

PEP 3135 doesn't address this, AFAICT.  It refers only to "the class", but
doesn't say whether this is the class-as-returned-by-decorator or original
defined class.  (ISTM that it should be the decorated class, since
otherwise this would be different behavior compared to code that explicitly
named the class.)

(Oh, and the rewrite looked good!)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20120604/84ecf255/attachment.html>
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4