Skip to content

builtins

Supported Python builtins.

abs(x)

Return the absolute value of a number.

Parameters:

Name Type Description Default
x int | float

A number.

required

Returns:

Type Description
int | float

The absolute value of x.

all(iterable)

Return True if all elements of the iterable are true.

Parameters:

Name Type Description Default
iterable Iterable[bool]

The iterable to evaluate.

required

Returns:

Type Description
bool

True if all elements are true, False otherwise.

any(iterable)

Return True if any element of the iterable is true.

Parameters:

Name Type Description Default
iterable Iterable[bool]

The iterable to evaluate.

required

Returns:

Type Description
bool

True if any element is true, False otherwise.

bool(x)

Convert a value to a Boolean.

Parameters:

Name Type Description Default
x int | float | bool

The value to convert.

required

Returns:

Type Description
bool

The Boolean value of x.

callable(obj)

Check if the object appears callable.

Parameters:

Name Type Description Default
obj object

The object to check.

required

Returns:

Type Description
bool

True if the object appears callable, False otherwise.

enumerate(iterable, start=0)

Return an enumerate object.

Parameters:

Name Type Description Default
iterable Iterable[T]

The iterable to enumerate.

required
start int

The starting index.

0

Returns:

Type Description
Iterator[tuple[int, T]]

An enumerate object.

filter(function, iterable)

Construct an iterator from those elements of iterable for which function returns true.

Parameters:

Name Type Description Default
function Callable[[T], bool] | None

A function that tests if each element should be included. If None, returns the elements that are true.

required
iterable Iterable[T]

The iterable to filter.

required

Returns:

Type Description
Iterator[T]

An iterator yielding the filtered elements.

float(x)

Convert a number to a floating point number.

Parameters:

Name Type Description Default
x int | float

The number to convert.

required

Returns:

Type Description
float

The floating point representation of x.

int(x)

Convert a number to an integer.

Parameters:

Name Type Description Default
x int | float

The number to convert.

required

Returns:

Type Description
int

The integer representation of x.

isinstance(obj, classinfo)

Check if an object is an instance of a class or of a subclass thereof.

Parameters:

Name Type Description Default
obj object

The object to check.

required
classinfo type | tuple[type, ...]

A type or a tuple of types.

required

Returns:

Type Description
bool

True if the object is an instance of classinfo, False otherwise.

issubclass(cls, classinfo)

Check if a class is a subclass of another class or a tuple of classes.

Parameters:

Name Type Description Default
cls type

The class to check.

required
classinfo type | tuple[type, ...]

A class or a tuple of classes.

required

Returns:

Type Description
bool

True if cls is a subclass of classinfo, False otherwise.

len(s)

Return the number of items in a container.

Parameters:

Name Type Description Default
s object

The container object.

required

Returns:

Type Description
int

The number of items in s.

map(function, iterable)

Apply a function to every item of an iterable and return an iterator.

Unlike the standard Python map function, it is possible that the function may be called more than once on the same item.

Parameters:

Name Type Description Default
function Callable[[T], S]

The function to apply.

required
iterable Iterable[T]

The iterable to process.

required

Returns:

Type Description
Iterator[S]

An iterator with the results.

reversed(seq)

Return a reverse iterator.

Parameters:

Name Type Description Default
seq Sequence[T]

The sequence to reverse.

required

Returns:

Type Description
Iterator[T]

An iterator over the reversed sequence.

round(number, ndigits=...)

Round a number to a given precision in decimal digits.

Parameters:

Name Type Description Default
number int | float

The number to round.

required
ndigits int

The number of decimal digits to round to.

...

Returns:

Type Description
float

The rounded number.

zip(*iterables)

Return an iterator of tuples, where the i-th tuple contains the i-th element from each of the argument sequences.

Parameters:

Name Type Description Default
*iterables Iterable[T]

Iterables to aggregate.

()

Returns:

Type Description
Iterator[tuple[T, ...]]

An iterator of aggregated tuples.