Mojo function
lookup_py_type_object
lookup_py_type_object[T: AnyType]() -> PythonObject
Retrieve a reference to the unique Python type describing Python objects containing Mojo values of type T.
This function looks up the Python type object that was previously registered
for the Mojo type T using a PythonTypeBuilder. The returned type object
can be used to create Python objects that wrap Mojo values of type T.
Parameters:
- T (
AnyType): The Mojo type to look up.
Returns:
PythonObject: A PythonObject representing the Python type object that binds the Mojo
type T to the current CPython interpreter instance.
Raises:
If no PythonTypeBuilder was ever finalized for type T, or if no
Python type object has been registered for the provided type identifier.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!