Sponsors
Become a sponsor-
iPulse AI
Open Agentic Investment Research Platform. Inspect deep multi-agent market forecasts and stock picks.
Listed in editorial order. Click a column header to re-sort the whole list.
Press / to search. Tags open their category. Click a row for details.
Search and filter
Results
| Row number | Tags | |||||
|---|---|---|---|---|---|---|
| 1 | functools Functional Programming | Stdlib | 77,691 | Functional Programming Python Language Stdlib | ||
|
(Python standard library) Higher-order functions and operations on callable objects.
|
||||||
| 2 | more-itertools Functional Programming | 242,008,259 | 4,103 | Functional Programming Python Language | ||
|
More routines for operating on iterables, beyond
itertools. |
||||||
| 3 | toolz Functional Programming | 65,026,568 | 5,161 | Functional Programming Python Language | ||
|
A collection of functional utilities for iterators, functions, and dictionaries. Also available as cytoolz for Cython-accelerated performance.
|
||||||
| 4 | funcy Functional Programming | 7,701,643 | 3,506 | Functional Programming Python Language | ||
|
Fancy and practical functional tools.
|
||||||
| 5 | returns Functional Programming | 1,237,175 | 4,383 | Functional Programming Python Language | ||
|
A set of type-safe monads, transformers, and composition utilities.
|
||||||
No projects match your search.
Try a broader term, or .
Functional Programming guide
functools is the standard library's module for higher-order functions, functions that act on or return other functions. Python's Functional Programming HOWTO calls partial() the most useful tool in the module: it fills in some of a function's arguments and gives you a new function. When you write a decorator, wrap its inner function with wraps, so the decorated function keeps its name and docstring. The same HOWTO finds many uses of reduce() clearer as a for loop.
The itertools docs point you to more-itertools for their recipes and many more. It collects building blocks beyond itertools, for grouping, windowing, lookahead, and more. The itertools recipes sit in its top-level package, so from more_itertools import flatten works.
toolz extends itertools and functools with functions that are composable, pure, and lazy, and its API follows Clojure's standard library. Each function takes and returns only iterables, dictionaries, and functions, so they compose to solve your own problems. pipe runs a value through a sequence of functions, like pipes in Unix. Stick with partial at first, and once it shows up several times in your code, switch to the toolz.curried namespace. toolz is a general-purpose library, and for data analytics its docs say a library built for it may serve you better. cytoolz implements the same API in Cython, as a drop-in replacement when you need more speed.
funcy is a collection of functional tools focused on practicality, inspired by Clojure and underscore. Next to sequence tools, it has collection functions that keep the type of a dict or set. It also has control flow helpers, like @retry and silent, and debugging helpers, like tap and log_calls. Many of its functions take a regex, a mapping, or a set where you'd pass a function.
returns puts results in typed containers: Maybe for None and Result for exceptions, plus IO for impure code and Future for async code. Its docs really recommend mypy, and typing only works correctly with its mypy plugin. So it fits projects that check types with mypy. Turn functions that raise into ones that return a Result with @safe, and chain the steps with flow, which its docs call the recommended way to write code with returns.
Mix functional style with the rest of your code: Python's HOWTO says functional-style programs usually give a functional-appearing interface and use non-functional features inside. For a plain map or filter, toolz's own docs call comprehensions more Pythonic. Learn a core set of functions; toolz says about a dozen covers most tasks, and the right word only helps when your readers know it too.
Contribute
Know a project that belongs here?
Tell us what it does and why it stands out.