Built-in Functions
Python built-in functions available without imports.
abs()
The built-in abs function returns the absolute value of a number, removing its sign. Works with integers, floats, and objects implementing __abs__
abs(number) aiter()
Return an async iterator for an asynchronous iterable. Used with async for loops to iterate over async iterables.
aiter(async_iterable) all()
The built-in all function returns True if all elements of an iterable are truthy (or if the iterable is empty)
all(iterable) anext()
The built-in anext function retrieves the next item from an async iterator, with optional default value for exhausted iterators
anext(async_iterator[, default]) any()
The built-in any function returns True if any element of an iterable is truthy
any(iterable) ascii()
The built-in ascii function returns a string containing a printable representation of an object, escaping non-ASCII characters
ascii(object) bin()
The built-in bin function converts an integer to a binary string prefixed with '0b'
bin(x) bool()
The built-in bool function converts a value to a boolean (True or False)
bool(x=False) breakpoint()
The built-in breakpoint function invokes the debugger by calling pdb.run() or the configured debugger
breakpoint(*args, **kwargs) bytearray()
The built-in bytearray function returns a mutable sequence of bytes that can be modified in place
bytearray([source[, encoding[, errors]]]) bytes()
The built-in bytes function returns an immutable bytes object, used for working with binary data
bytes([source[, encoding[, errors]]]) callable()
The built-in callable function checks if an object appears callable, returning True or False
callable(object) chr()
The built-in chr function returns a string representing a character whose Unicode code point is the given integer
chr(i) classmethod()
The built-in classmethod function transforms a method into a class method, receiving the class as the first argument instead of an instance
classmethod(function) compile()
The built-in compile function compiles a source string or AST object into a code object that can be executed by exec() or eval()
compile(source, filename, mode, flags=0, dont_inherit=False, optimize=-1) complex()
The built-in complex function creates a complex number or converts a number or string to a complex number
complex(real=0, imag=0) delattr()
Deletes a named attribute from an object. Removes the attribute specified by name from the given object.
delattr(object, name) dict()
The built-in dict function creates a new dictionary object, either empty or from key-value pairs
dict(**kwargs) / dict(mapping) / dict(iterable) dir()
The built-in dir function returns a list of names in the current local scope or the attributes of an object.
dir([object]) divmod()
The built-in divmod function takes two numbers and returns a tuple containing their quotient and remainder.
divmod(a, b) enumerate()
The built-in enumerate function adds a counter to an iterable and returns it as an enumerate object that yields index-element pairs.
enumerate(iterable, start=0) eval()
The built-in eval function evaluates a Python expression as a string and returns the result. Use with caution on untrusted input due to security risks
eval(expression, globals=None, locals=None) exec()
The built-in exec function executes dynamically created Python code from a string or compiled code object. Use with caution on untrusted input.
exec(object, globals=None, locals=None) filter()
Return an iterator yielding items from an iterable for which a function returns true.
filter(function, iterable) float()
The built-in float() function converts a number or string to a floating-point number.
float(x=0.0) format()
The built-in format function converts values to formatted strings using a format spec mini-language. Essential for precise numeric and string presentation.
format(value[, format_spec]) frozenset()
The built-in frozenset function creates an immutable set object that cannot be modified after creation
frozenset([iterable]) getattr()
The built-in getattr function returns the value of an object attribute by name, with optional default for missing attributes
getattr(object, name[, default]) globals()
The built-in globals function returns a dictionary representing the current global namespace, enabling dynamic access and modification of global variables
globals() hasattr()
The built-in hasattr function checks if an object has a named attribute, returning True if the attribute exists and False otherwise
hasattr(object, name) hash()
Return the hash value of an object. Hash values are integers used to quickly compare dictionary keys during a dictionary lookup.
hash(object) help()
Invoke the built-in help system to display documentation for objects, modules, functions, and other Python constructs.
help([object]) hex()
The built-in hex function converts an integer to a lowercase hexadecimal string with a '0x' prefix.
hex(x) id()
The built-in id function returns the unique identity integer of an object, which corresponds to its memory address in CPython
id(object) input()
The built-in input function reads a line from standard input, converts it to a string, and returns it
input([prompt]) int()
The built-in int function converts a number or string to an integer. Supports different bases for string conversion and handles float truncation
int(x=0) / int(x, base=10) isinstance()
The built-in isinstance function checks if an object is an instance of a class or tuple of classes, supporting type checking for clean, pythonic code
isinstance(object, classinfo) issubclass()
The built-in issubclass() function checks if a class is a subclass of another class or tuple of classes
issubclass(class, classinfo) iter()
The built-in iter function returns an iterator object from an iterable or a callable with a sentinel value
iter(object[, sentinel]) len()
The built-in len function returns the number of items in a container or the length of a string
len(s) list()
The built-in list constructor creates a new list from an iterable or returns an empty list
list([iterable]) locals()
The built-in locals function returns a dictionary of the current local namespace, providing access to local variables within the current scope
locals() map()
The built-in map function applies a function to every item in an iterable and returns an iterator with the results
map(function, iterable, *iterables) max()
The built-in max function returns the largest item from an iterable or the largest of two or more arguments
max(iterable, *[, key, default]) memoryview()
Create a memory view object that exposes the underlying buffer of a bytes or bytearray object without copying.
memoryview(object) min()
The built-in min function returns the smallest item from an iterable or the smallest of two or more arguments
min(iterable, *[, key, default]) next()
The built-in next function retrieves the next item from an iterator, returning a default value if the iterator is exhausted.
next(iterator[, default]) object()
The base class for all objects in Python, providing default implementations for common methods.
object() oct()
The built-in oct function converts an integer to an octal string with a '0o' prefix.
oct(x) open()
The built-in open function opens a file and returns a file object for reading, writing, or modifying file contents
open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) ord()
The built-in ord function returns an integer representing the Unicode code point of a character
ord(c) pow()
The built-in pow function computes base raised to the power of exp, with optional modulus for efficient modular exponentiation.
pow(base, exp[, mod]) print()
The built-in print function writes objects to a text stream, separated by sep and followed by end
print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False) property()
The built-in property function creates a property attribute for managed access to class attributes
property(fget=None, fset=None, fdel=None, doc=None) range()
The built-in range function generates an immutable sequence of integers, commonly used for looping a specific number of times
range(stop)
range(start, stop)
range(start, stop, step) repr()
The built-in repr function returns a string containing a printable representation of an object, often useful for debugging and logging.
repr(object) reversed()
The built-in reversed function returns a reverse iterator over a sequence or other object supporting iteration.
reversed(seq) round()
The built-in round function rounds a number to a given number of decimal places. Uses banker's rounding (round half to even).
round(number[, ndigits]) set()
The built-in set function creates a new set object from an iterable, or an empty set if no argument is provided
set([iterable]) setattr()
The built-in setattr function sets a named attribute on an object at runtime
setattr(object, name, value) slice()
The built-in slice function creates a slice object for extracting portions of sequences
slice(stop) / slice(start, stop[, step]) sorted()
The built-in sorted function returns a new sorted list from the items in an iterable, with optional key and reverse parameters for customization.
sorted(iterable, /, *, key=None, reverse=False) staticmethod()
The staticmethod decorator transforms a function into a static method that can be called on a class without instantiating it
staticmethod(function) str()
The built-in str function converts an object to a string representation
str(object='', encoding='utf-8', errors='strict') sum()
The built-in sum function returns the total of all items in an iterable plus an optional starting value.
sum(iterable, /, start=0) super()
The built-in super function returns a proxy object that delegates method calls to a parent or sibling class
super([type[, object-or-type]]) tuple()
The built-in tuple function converts an iterable into a tuple, creating an immutable, ordered sequence of elements
tuple([iterable]) type()
The built-in type function returns the type of an object or creates a new type dynamically
type(object) / type(name, bases, dict) vars()
The built-in vars function returns the __dict__ attribute of an object, or the current local symbol table as a dictionary
vars([object]) zip()
The built-in zip function iterates over multiple iterables in parallel, returning tuples of corresponding elements
zip(*iterables, strict=False)