Mojo trait
ConvertibleToPython
A trait that indicates a type can be converted to a PythonObject, and that specifies the behavior with a to_python_object
method.
Implemented traits
AnyType
,
UnknownDestructibility
Aliases
__del__is_trivial
alias __del__is_trivial
A flag (often compiler generated) to indicate whether the implementation of __del__
is trivial.
The implementation of __del__
is considered to be trivial if:
- The struct has a compiler-generated trivial destructor and all its fields
have a trivial
__del__
method.
In practice, it means that the __del__
can be considered as no-op.
Methods
to_python_object
to_python_object(var self: _Self) -> PythonObject
Convert a value to a PythonObject.
Returns:
PythonObject
: A PythonObject representing the value.
Raises:
If the conversion to a PythonObject failed.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!