builtins – builtin functions and exceptions

All builtin functions and exceptions are described here. They are also available via the 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

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

See CPython documentation: bytes.

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

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

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

frozenset() is not enabled on the smallest CircuitPython boards for space reasons.

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

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

to_bytes(size, byteorder)

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

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

reversed() is not enabled on the smallest CircuitPython boards for space reasons.

builtins.round()
class builtins.set
builtins.setattr()
class builtins.slice

The slice builtin is the type that slice objects have.

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

Exceptions

exception builtins.ArithmeticError
exception builtins.AssertionError
exception builtins.AttributeError
exception builtins.BaseException
exception builtins.BrokenPipeError
exception builtins.ConnectionError
exception builtins.EOFError
exception builtins.Exception
exception builtins.ImportError
exception builtins.IndentationError
exception builtins.IndexError
exception builtins.KeyboardInterrupt
exception builtins.KeyError
exception builtins.LookupError
exception builtins.MemoryError
exception builtins.NameError
exception builtins.NotImplementedError
exception builtins.OSError
exception builtins.OverflowError
exception builtins.RuntimeError
exception builtins.ReloadException

ReloadException is used internally to deal with soft restarts.

Not a part of the CPython standard library

exception builtins.StopAsyncIteration
exception builtins.StopIteration
exception builtins.SyntaxError
exception builtins.SystemExit

See CPython documentation: SystemExit.

exception builtins.TimeoutError
exception builtins.TypeError

See CPython documentation: TypeError.

exception builtins.UnicodeError
exception builtins.ValueError
exception builtins.ZeroDivisionError

Constants

builtins.Ellipsis
builtins.NotImplemented