2.4. Supported Python features

Apart from the Language part below, which applies to both object mode and nopython mode, this page only lists the features supported in nopython mode.

2.4.1. Language

2.4.1.1. Constructs

Numba strives to support as much of the Python language as possible, but some language features are not available inside Numba-compiled functions:

  • Function definition
  • Class definition
  • Exception handling (try .. except, try .. finally)
  • Context management (the with statement)

The raise statement is only supported in the simplest form of raising a type without explicitly creating an instance, i.e. raise TypeError is possible but not raise TypeError("some message").

Similarly, the assert statement is only supported without an explicit error message.

2.4.1.2. Function calls

Numba supports function calls using positional and named arguments. *args and **kwargs are not supported.

2.4.2. Built-in types

2.4.2.1. int, bool

Arithmetic operations as well as truth values are supported.

The following attributes and methods are supported:

  • .conjugate()
  • .real
  • .imag

2.4.2.2. float, complex

Arithmetic operations as well as truth values are supported.

The following attributes and methods are supported:

  • .conjugate()
  • .real
  • .imag

2.4.2.3. tuple

Tuple construction and unpacking is supported.

2.4.2.4. None

The None value is supported for identity testing (when using an optional type).

2.4.3. Built-in functions

The following built-in functions are supported:

2.4.4. Standard library modules

2.4.4.2. ctypes

Numba is able to call ctypes-declared functions with the following argument and return types:

2.4.5. Third-party modules

2.4.5.1. cffi

Similarly to ctypes, Numba is able to call into cffi-declared external functions, using the following C types:

  • char
  • short
  • int
  • long
  • long long
  • unsigned char
  • unsigned short
  • unsigned int
  • unsigned long
  • unsigned long long
  • int8_t
  • uint8_t
  • int16_t
  • uint16_t
  • int32_t
  • uint32_t
  • int64_t
  • uint64_t
  • float
  • double
  • char *
  • void *
  • uint8_t *
  • ssize_t
  • size_t
  • void