Runtime Utility Functions

types.prepare_class()

Select the metaclass, prepare a namespace and return the remaining header keywords with metaclass removed. Does not itself create the class.

Formal Syntax & Structure

python syntaxpython
types.prepare_class(name, bases=(), kwds=None)

Parameters & Attributes

NameTypeDescription
namestrName of the class to create or prepare.
basestupleOriginal base class entries.
kwdsdict or NoneClass-header keyword arguments, including an optional metaclass.

Return Value

tuple

The tuple result described above.

Working Example

Example Snippetpython
import typesmeta, ns, kwds=types.prepare_class("C")ns["value"]=8C=meta("C",(),ns,**kwds)print(C().value)
Python Reference