builtins – builtin functions and exceptions — MicroPython latest documentation (original) (raw)
This is the documentation for the latest development branch of MicroPython and may refer to features that are not available in released versions.
If you are looking for the documentation for a specific release, use the drop-down menu on the left and select the desired version.
All builtin functions and exceptions are described here. They are also available via builtins
module.
Functions and types¶
abs()¶
all()¶
any()¶
bin()¶
class bool¶
class bytearray¶
See CPython documentation: 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¶
getattr()¶
globals()¶
hasattr()¶
hash()¶
hex()¶
id()¶
input()¶
class int¶
classmethod from_bytes(bytes, byteorder)¶
In MicroPython, byteorder parameter must be positional (this is compatible with CPython).
to_bytes(size, byteorder)¶
In MicroPython, byteorder parameter must be positional (this is compatible with CPython).
Note
The optional signed
kwarg from CPython is not supported. MicroPython currently converts negative integers as signed, and positive as unsigned. (Details.)
isinstance()¶
issubclass()¶
iter()¶
len()¶
class list¶
locals()¶
map()¶
max()¶
class memoryview¶
See CPython documentation: memoryview.
min()¶
next()¶
class object¶
oct()¶
open()¶
ord()¶
pow()¶
print()¶
property()¶
range()¶
repr()¶
reversed()¶
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 AssertionError¶
exception AttributeError¶
exception Exception¶
exception ImportError¶
exception IndexError¶
exception KeyboardInterrupt¶
See CPython documentation: KeyboardInterrupt.
See also in the context of Soft Bricking (failure to boot).
exception KeyError¶
exception MemoryError¶
exception NameError¶
exception NotImplementedError¶
exception OSError¶
exception RuntimeError¶
exception StopIteration¶
exception SyntaxError¶
exception SystemExit¶
See CPython documentation: SystemExit.
On non-embedded ports (i.e. Windows and Unix), an unhandled SystemExit
exits the MicroPython process in a similar way to CPython.
On embedded ports, an unhandled SystemExit
currently causes aSoft Reset of MicroPython.
exception TypeError¶
See CPython documentation: TypeError.
exception ValueError¶
exception ZeroDivisionError¶