Section: Decorators and higher-order functions

Partial function

python
python
from functools import partial
base2 = partial(int, base=2)
value = base2("1010")

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Decorators and higher-order functions
Reduce values
Reduce values
OpenIn sheetpythonsame section
Simple decorator
Simple decorator
OpenIn sheetpythonsame section
Decorator factory
Decorator factory
OpenIn sheetpythonsame section
Map over data
Map over data
OpenIn sheetpythonsame section
Filter data
Filter data
OpenIn sheetpythonsame section
Define a function
Define a function