[docs] [issue15243] Misleading documentation for __prepare__

William Schwartz report at bugs.python.org
Tue Jul 3 17:08:38 CEST 2012

New submission from William Schwartz <wkschwartz at gmail.com>:

Section "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 at python
components: Documentation, Tests
messages: 164606
nosy: William.Schwartz, docs at python
priority: normal
severity: normal
status: open
title: Misleading documentation for __prepare__
type: behavior
versions: Python 3.3

Python tracker <report at bugs.python.org>

More information about the docs mailing list