Mention that type.__prepare__() exists for use via super().

This commit is contained in:
Guido van Rossum 2007-08-02 16:51:59 +00:00
parent 8f149af2f9
commit 2ca9a1402a
1 changed files with 4 additions and 0 deletions

View File

@ -132,6 +132,10 @@ Invoking the Metaclass
assignment algorithm. (Note also that 'metaclass' is a keyword- assignment algorithm. (Note also that 'metaclass' is a keyword-
only argument as per PEP 3102 [6].) only argument as per PEP 3102 [6].)
Even though __prepare__ is not required, the default metaclass
('type') implements it, for the convenience of subclasses calling
it via super().
__prepare__ returns a dictionary-like object which is used to store __prepare__ returns a dictionary-like object which is used to store
the class member definitions during evaluation of the class body. the class member definitions during evaluation of the class body.
In other words, the class body is evaluated as a function block In other words, the class body is evaluated as a function block