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