Skip to content

builtins

Supported Python builtins.

abs(x: builtins.int | builtins.float) -> builtins.int | builtins.float

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: Iterable[builtins.bool]) -> builtins.bool

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: Iterable[builtins.bool]) -> builtins.bool

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: builtins.int | builtins.float | builtins.bool) -> builtins.bool

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: object) -> bool

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: Iterable[T], start: int = 0) -> Iterator[tuple[int, T]]

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: Callable[[T], builtins.bool] | None, iterable: Iterable[T]) -> Iterator[T]

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: builtins.int | builtins.float) -> builtins.float

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: builtins.int | builtins.float) -> builtins.int

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: object, classinfo: type | tuple[type, ...]) -> builtins.bool

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: type, classinfo: type | tuple[type, ...]) -> builtins.bool

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.

iter(iterable: Iterable[T]) -> Iterator[T]

Return an iterator for the given iterable.

Parameters:

Name Type Description Default
iterable Iterable[T]

The iterable to convert to an iterator.

required

Returns:

Type Description
Iterator[T]

An iterator over the elements of the iterable.

len(s: object) -> builtins.int

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: Callable[[T], S], iterable: Iterable[T]) -> Iterator[S]

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

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.

max(*args, **kwargs)

max(
    iterable: Iterable[T],
    *,
    key: Callable[[T], Any] | None = ...,
) -> T
max(
    iterable: Iterable[builtins.int | builtins.float],
    *,
    default: builtins.int | builtins.float = ...,
    key: Callable[[builtins.int | builtins.float], Any]
    | None = ...,
) -> builtins.int | builtins.float
max(
    arg1: T,
    arg2: T,
    *args: T,
    key: Callable[[T], Any] | None = ...,
) -> T

Return the largest item in an iterable or the largest of multiple arguments.

When called with a single iterable, returns the largest item from that iterable. When called with multiple arguments, returns the largest argument.

Use the key parameter to specify a function that transforms each element before comparison. Use the default parameter to specify a value to return if the iterable is empty (supported only for numeric values).

min(*args, **kwargs)

min(
    iterable: Iterable[T],
    *,
    key: Callable[[T], Any] | None = ...,
) -> T
min(
    iterable: Iterable[builtins.int | builtins.float],
    *,
    default: builtins.int | builtins.float = ...,
    key: Callable[[builtins.int | builtins.float], Any]
    | None = ...,
) -> builtins.int | builtins.float
min(
    arg1: T,
    arg2: T,
    *args: T,
    key: Callable[[T], Any] | None = ...,
) -> T

Return the smallest item in an iterable or the smallest of multiple arguments.

When called with a single iterable, returns the smallest item from that iterable. When called with multiple arguments, returns the smallest argument.

Use the key parameter to specify a function that transforms each element before comparison. Use the default parameter to specify a value to return if the iterable is empty (supported only for numeric values).

next(iterator: Iterator[T]) -> T

Retrieve the next item from an iterator.

Errors if the iterator is exhausted.

Parameters:

Name Type Description Default
iterator Iterator[T]

The iterator to retrieve the next item from.

required

Returns:

Type Description
T

The next item from the iterator.

range(*args) -> builtins.range

range(stop: builtins.int) -> builtins.range
range(
    start: builtins.int,
    stop: builtins.int,
    step: builtins.int = ...,
) -> builtins.range

Return an immutable sequence of numbers.

When called with one argument, creates a sequence from 0 to that number (exclusive). When called with two arguments, creates a sequence from the first to the second (exclusive). When called with three arguments, the third argument specifies the step size.

reversed(seq: Sequence[T]) -> Iterator[T]

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: builtins.int | builtins.float, ndigits: builtins.int = ...) -> builtins.float

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.

sum(iterable: Iterable[builtins.int | builtins.float], /, start: builtins.int | builtins.float = 0) -> builtins.int | builtins.float

Return the sum of a 'start' value (default: 0) and an iterable of numbers.

Parameters:

Name Type Description Default
iterable Iterable[int | float]

The iterable of numbers to sum.

required
start int | float

The starting value to add to the sum.

0

Returns:

Type Description
int | float

The total sum.

super(cls: type = ..., instance: Any = ...) -> Any

Return a proxy object that delegates method calls to a parent or sibling class.

Parameters:

Name Type Description Default
cls type

The class to delegate

...
instance Any

The instance to delegate to.

...

Returns: A proxy object that can be used to call methods from the parent or sibling class.

zip(*iterables: Iterable[T]) -> Iterator[tuple[T, ...]]

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.