On this page
types.prepare_class
Prev: types.new_class | Up: types | Next: types.resolve_bases
Rel: types.AsyncGeneratorType, types.BuiltinFunctionType, types.BuiltinMethodType, types.CapsuleType
Ref: docs.python.org — types.prepare_class
Tags: #public #python3 #stdlib #types
Import
import types
from types import prepare_class
Signature & Overview
types.prepare_class(name, bases=(), kwds=None)
Call the prepare method of the appropriate metaclass.
Usage
import types
meta, ns, kw = types.prepare_class('Demo', (object,))
assert meta is type and isinstance(ns, dict)
Gotchas
- Calculates the winning metaclass and calls
__prepare__(used internally bynew_class()).
REPL Inspect
from types import prepare_class
help(prepare_class)
Linked from
Related notes
- tuts/python3/stdlib_module/types/new_class Linked here; links to this page; shared tags: #stdlib, #types
- tuts/python3/stdlib_module/types/resolve_bases Linked here; links to this page; shared tags: #stdlib, #types
- tuts/python3/stdlib_module/types Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/types/AsyncGeneratorType Linked here; shared tags: #stdlib, #types
- tuts/python3/stdlib_module/types/BuiltinFunctionType Linked here; shared tags: #stdlib, #types
- tuts/python3/stdlib_module/types/BuiltinMethodType Linked here; shared tags: #stdlib, #types
- tuts/python3/stdlib_module/types/CapsuleType Linked here; shared tags: #stdlib, #types
- tuts/c/stdlib/stdint_stdbool_and_limits shared tags: #stdlib, #types
- tuts/python3/stdlib_module/types/CellType shared tags: #stdlib, #types
- tuts/python3/stdlib_module/types/ClassMethodDescriptorType shared tags: #stdlib, #types