@jit
decorator will automatically fall back to object
mode if nopython mode cannot be used.OptionalType
OptionalType
is effectively a type union of a type
and None
.
They typically occur in practice due to a variable being set to None
and then in a branch the variable being set to some other value. It’s
often not possible at compile time to determine if the branch will execute
so to permit type inference to complete, the type of the variable
becomes the union of a type
(from the value) and None
,
i.e. OptionalType(type)
.In numba, when a mutable container is passed as argument to a nopython function from the Python interpreter, the container object and all its contained elements are converted into nopython values. To match the semantics of Python, any mutation on the container inside the nopython function must be visible in the Python interpreter. To do so, Numba must update the container and its elements and convert them back into Python objects during the transition back into the interpreter.
Not to be confused with Python’s “reflection” in the context of binary operators (see https://docs.python.org/3.5/reference/datamodel.html).