types#

Classes

DynamicClassAttribute

Route attribute access on a class to __getattr__.

GenericAlias

Represent a PEP 585 generic type

SimpleNamespace

A simple attribute-based namespace.

UnionType

Represent a PEP 604 union type

Define names for built-in types that aren’t directly accessible as a builtin.

Functions

coroutine(func)

Convert regular generator function to a coroutine.

new_class(name[, bases, kwds, exec_body])

Create a class object dynamically using the appropriate metaclass.

prepare_class(name[, bases, kwds])

Call the __prepare__ method of the appropriate metaclass.

resolve_bases(bases)

Resolve MRO entries dynamically as specified by PEP 560.

types.new_class(name, bases=(), kwds=None, exec_body=None)[source]#

Create a class object dynamically using the appropriate metaclass.

types.resolve_bases(bases)[source]#

Resolve MRO entries dynamically as specified by PEP 560.

types.prepare_class(name, bases=(), kwds=None)[source]#

Call the __prepare__ method of the appropriate metaclass.

Returns (metaclass, namespace, kwds) as a 3-tuple

metaclass is the appropriate metaclass namespace is the prepared class namespace kwds is an updated copy of the passed in kwds argument with any ‘metaclass’ entry removed. If no kwds argument is passed in, this will be an empty dict.

types.coroutine(func)[source]#

Convert regular generator function to a coroutine.