Skip to content

Commit 548685e

Browse files
miss-islingtonalclarks
authored andcommitted
bpo-15243: Document __prepare__ as classmethod (GH-17124)
(cherry picked from commit 7de6174) Co-authored-by: alclarks <[email protected]>
1 parent 71d2b33 commit 548685e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Doc/reference/datamodel.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1931,7 +1931,8 @@ Preparing the class namespace
19311931
Once the appropriate metaclass has been identified, then the class namespace
19321932
is prepared. If the metaclass has a ``__prepare__`` attribute, it is called
19331933
as ``namespace = metaclass.__prepare__(name, bases, **kwds)`` (where the
1934-
additional keyword arguments, if any, come from the class definition).
1934+
additional keyword arguments, if any, come from the class definition). The
1935+
``__prepare__`` method should be implemented as a :func:`classmethod`.
19351936

19361937
If the metaclass has no ``__prepare__`` attribute, then the class namespace
19371938
is initialised as an empty ordered mapping.

0 commit comments

Comments
 (0)