New submission from William Schwartz <wkschwa...@gmail.com>:

Section 3.3.3.2. "Preparing the class namespace" of the documentation 
(http://docs.python.org/dev/reference/datamodel.html#preparing-the-class-namespace)
 states that "If the metaclass has a __prepare__ attribute, it is called as 
``namespace = metaclass.__prepare__(name, bases, **kwds)``...." This isn't 
quite true. By just defining a ``__prepare__`` method in a metaclass, the 
interpreter calls it as it would a static method -- there is no implicit first 
argument referring to ``metaclass`` as the documentation implies. The 
documentation should be amended to say that users can decorate ``__prepare__`` 
as a class method to get ``metaclass`` passed in as the implicit first argument.

----------
assignee: docs@python
components: Documentation, Tests
messages: 164606
nosy: William.Schwartz, docs@python
priority: normal
severity: normal
status: open
title: Misleading documentation for __prepare__
type: behavior
versions: Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15243>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to