[Python-Dev] Language reference updated for metaclasses (original) (raw)

Eli Bendersky eliben at gmail.com
Tue Jun 5 05:24:23 CEST 2012


On Sun, May 20, 2012 at 10:38 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:

When writing the docs for types.newclass(), 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

"if an explicit metaclass is given and it is not an instance of type(), then it is used directly as the metaclass"

Could you elaborate on this point? Would it perhaps be clearer to say "if an explicit metaclass is given and it is not a class"?

Eli



More information about the Python-Dev mailing list