Moving Data Across the Bridge
Convert between Mojo and Python values.
Two Worlds of Values
Mojo has its own native types, and Python has its own. Interop means converting values as they cross between the two worlds.
Mojo to Python
When you pass a Mojo value into a Python call, Mojo automatically wraps it into a PythonObject Python can understand.
var n: Int = 42
print(np.sqrt(n))All lessons in this course
- Importing a Python Module
- Calling Python Functions
- Moving Data Across the Bridge
- When to Use Python Interop