From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Sat, 25 Jan 2020 19:04:16 +0000 (-0800) Subject: bpo-15243: Document __prepare__ as classmethod (GH-17124) X-Git-Tag: v3.8.2rc1~41 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=321491a536c378227f9d574703f7c06f89c67dcf;p=thirdparty%2FPython%2Fcpython.git bpo-15243: Document __prepare__ as classmethod (GH-17124) (cherry picked from commit 7de617455ed788e6730c40cf854c4b72b0432194) Co-authored-by: alclarks <57201106+alclarks@users.noreply.github.com> --- diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index e801ee392f19..7b3bf0d2f5f3 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1945,7 +1945,8 @@ Preparing the class namespace Once the appropriate metaclass has been identified, then the class namespace is prepared. If the metaclass has a ``__prepare__`` attribute, it is called as ``namespace = metaclass.__prepare__(name, bases, **kwds)`` (where the -additional keyword arguments, if any, come from the class definition). +additional keyword arguments, if any, come from the class definition). The +``__prepare__`` method should be implemented as a :func:`classmethod`. If the metaclass has no ``__prepare__`` attribute, then the class namespace is initialised as an empty ordered mapping.