0Pricing
Mojo Academy · Lesson

Reading Python Objects Back

Unpack results returned by Python.

Results Come Back

When a Python function returns, you get a value back in Mojo. Knowing how to unpack it lets you use the result in your code. 📦

Always a PythonObject

Every Python call returns a PythonObject, Mojo's wrapper around whatever Python produced, be it a number, string, or array.

var total = np.sum(a)

All lessons in this course

  1. Using NumPy from Mojo
  2. Passing Mojo Data to Python
  3. Reading Python Objects Back
  4. Interop Performance Gotchas
← Back to Mojo Academy