Built-In Functions

Functional Programming

map
Applies function to every item of an iterable object and returns a list of the results.
filter
Returns a sequence from those elements of iterable for which function returns True.
reduce
Applies function of two arguments cumulatively to the items of iterable, from left to right, so as to reduce the iterable to a single value.

Numeric Types Conversions and Constructors

bool
Returns an expression converted into a Boolean.
int
Returns an expression converted into an integer number.
long
Returns an expression converted into a long integer number.
float
Returns an expression converted into a floating point number.
complex
Returns an expression converted into a complex number.

Numeric Types Conversions

bin
Returns an integer converted into a binary string.
oct
Returns an integer converted into an octal string.
hex
Returns an integer converted into a hexadecimal string.

Arithmetic

abs
Returns the absolute value of a number.
pow
Returns a number raised to a power; or optionally a modulus of the number raised to a power and another number.
round
Returns a floating point number rounded to a specified number of decimal places.
divmod
Returns quotient and remainder after a division of two numbers.

String Conversions

chr
Returns a string of one character whose ASCII code is the specified number.
ord
Returns an integer representing the code of the character.
unichr
Returns a Unicode character specified by the code.
format
Returns a formatted string.
repr
Returns a string containing a printable representation of an object.

Sequences Constructors

str
Returns a string containing a printable representation of an object.
unicode
Returns the Unicode string version of object.
list
Converts an object into a list.
tuple
Returns a tuple built from iterable.
bytearray
Returns a new array of bytes.
buffer
Returns a new buffer object which references the object argument.
memoryview
Returns a memoryview object.
range
Returns a list of arithmetic progressions.
xrange
Returns an xrange object.

Mappings Constructors

dict
Returns a dictionary object.
set
Returns a set type initialized from iterable.
frozenset
Returns a frozenset object.

Operating on Containers

enumerate
Returns an enumerate object.
len
Returns an int type specifying number of elements in the collection.
reversed
Returns a reverse iterator over a sequence.
sorted
Returns a sorted list from the iterable.
sum
Returns a total of the items contained in the iterable object.
zip
Returns a list of tuples, where the i-th tuple contains the i-th element from each of the argument sequences or iterables.
slice
Returns a slice object.

Iterators

iter
Returns an iterator object.
next
Retrieves the next item from the iterator by calling its next() method.

Comparisons

cmp
Compares two objects and returns an integer according to the outcome.
max
Returns the largest item in an iterable or the largest of two or more arguments.
min
Returns the smallest item from a collection.
all
Returns a Boolean value that indicates whether the collection contains only values that evaluate to True.
any
Returns a Boolean value that indicates whether the collection contains any values that evaluate to True.

Identity

hash
Return the hash value of the object (if it has one).
id
Returns the “identity” of an object.

File Objects Constructors

file
Returns a file object.
open
Opens a file returning a file object.

Object Oriented Functions

classmethod
Returns a class method for the function.
property
Returns a property attribute for new-style classes (classes that derive from object).
staticmethod
Returns a static method for function.
super
Returns a proxy object that delegates method calls to a parent or sibling class of type.
setattr
Assigns a value to the object’s attribute given its name.
getattr
Returns the value of the named attribute of object.
delattr
Deletes the named attribute of an object.
hasattr
Returns a Boolean stating whether the object has the specified attribute.
isinstance
Returns a Boolean stating whether the object is an instance or subclass of another object.
issubclass
Returns a Bool type indicating whether an object is a subclass of a class.
vars
Returns the mapping of an object’s (writable) attributes.
dir
Returns the list of names in the current local scope. If supplied with an argument attempts to return a list of valid attributes for that object.
type (1)
Returns the type of an object (constructor name).
type (2)
Returns a new type object.

Information

callable
Returns a Boolean stating whether the object argument appears callable.
globals
Returns a dictionary representing the current global symbol table.
locals
Returns a dictionary representing the current local symbol table.
help
Invokes the built-in help system.

System

__import__
Imports a module.
reload
Reloads a previously imported module.
compile
Returns an AST or code object.
execfile
Evaluates contents of a file.
eval
Returns a result of the evaluation of a Python expression.
input
Evaluates user input.
intern
Enters the string into interned strings table (if not already there).
print
Returns a printed representation of the objects.
raw_input
Reads a line from standard input stream.

Misc

object
Returns a new featureless object.
apply
Returns the result of a function or class object called with supplied arguments.
basestring
This abstract type is the superclass for str and unicode. It cannot be called or instantiated, but it can be used to test whether an object is an instance of str or unicode.
coerce
Returns a tuple consisting of the two numeric arguments converted to a common type.