Built-in

tuple

The tuple class returns an immutable iterable object of type tuple (a tuple).

Submitted by admin on Tue, 01/19/2021 - 10:04

set

The set built-in class returns a set made up of the elements of the iterable included as an argument.

Submitted by admin on Mon, 01/18/2021 - 23:10

reversed

The reversed function returns an iterator made up of the values of the object included as an argument after reversing their order.

Submitted by admin on Sun, 01/17/2021 - 15:38

range

The range function represents an immutable sequence of integers. If used by passing it a single stop argument, it generates a sequence of consecutive integers between 0 and stop -1. If used by passing it two arguments, start and stop, it generates a sequence of consecutive integers between start and stop -1. In the latter case, the inclusion of a third step argument forces the sequence of numbers to be generated with a "step" jump between one number and the next.

Submitted by admin on Sun, 01/17/2021 - 12:25

next

The next function returns the next element of the iterator included as the first argument by invoking its __next__ method.

In the case that the iterator is empty, an exception of type StopIteration will be generated unless a second argument ("default") has been included, in which case it will be returned as a result of the function.

Submitted by admin on Thu, 01/14/2021 - 18:14

iter

The iter function returns an iterable object from another object. In its simplest configuration it will only receive one argument -the object to be made iterable-. This requires that said object support the iteration or sequence protocols (__iter__ and __getitem__ methods respectively). If none of them are supported, the iter function will return a type error (TypeError).

Submitted by admin on Thu, 01/14/2021 - 17:41

map

The map function applies a function to the values of the iterable that we specify as an argument. In the case that two or more iterables are specified as arguments, the function will consider their values in parallel, stopping returning values as soon as the end of the shortest iterable is reached (see examples below).

Submitted by admin on Thu, 01/14/2021 - 17:07

issubclass

The issubclass function takes two classes, class and classinfo, as arguments, and returns the boolean True if class is a subclass of classinfo, or False otherwise.

A class is always considered a subclass of itself.

Submitted by admin on Wed, 01/13/2021 - 17:40

isinstance

The isinstance function takes an object and a class as arguments and returns True if the object is an instance of that class or an instance of a subclass of it.

The second argument (the class) can also be a tuple of classes or a recursive structure of tuples of classes, in which case the boolean True will be returned if the object belongs to any of the classes contained in the structure.

Submitted by admin on Wed, 01/13/2021 - 15:24