builtins – builtin functions and exceptions

All builtin functions and exceptions are described here. They are also available via builtins module.

For more information about built-ins, see the following CPython documentation:

Note

Not all of these functions, types, exceptions, and constants are turned on in all CircuitPython ports, for space reasons.

Functions and types

abs()
all()
any()
bin()
class bool
class bytearray
class bytes

See CPython documentation: bytes.

callable()
chr()
classmethod()
compile()
class complex
delattr(obj, name)

The argument name should be a string, and this function deletes the named attribute from the object given by obj.

class dict
dir()
divmod()
enumerate()
eval()
exec()
filter()
class float
class frozenset

frozenset() is not enabled on non-Express CircuitPython boards.

getattr()
globals()
hasattr()
hash()
hex()
id()
input()
class int
classmethod from_bytes(bytes, byteorder)

In CircuitPython, byteorder parameter must be positional (this is compatible with CPython).

to_bytes(size, byteorder)

In CircuitPython, byteorder parameter must be positional (this is compatible with CPython).

isinstance()
issubclass()
iter()
len()
class list
locals()
map()
max()
class memoryview
min()
next()
class object
oct()
open()
ord()
pow()
print()
property()
range()
repr()
reversed()

reversed() is not enabled on non-Express CircuitPython boards.

round()
class set
setattr()
class slice

The slice builtin is the type that slice objects have.

sorted()
staticmethod()
class str
sum()
super()
class tuple
type()
zip()

Exceptions

exception ArithmeticError
exception AssertionError
exception AttributeError
exception BaseException
exception BrokenPipeError
exception ConnectionError
exception EOFError
exception Exception
exception ImportError
exception IndentationError
exception IndexError
exception KeyboardInterrupt
exception KeyError
exception LookupError
exception MemoryError
exception MpyError

Not a part of the CPython standard library

exception NameError
exception NotImplementedError
exception OSError
exception OverflowError
exception RuntimeError
exception ReloadException

ReloadException is used internally to deal with soft restarts.

Not a part of the CPython standard library

exception StopAsyncIteration
exception StopIteration
exception SyntaxError
exception SystemExit
exception TimeoutError
exception TypeError
exception UnicodeError
exception ValueError
exception ZeroDivisionError

Constants

Ellipsis
NotImplemented