Functional Classes
functools.partial()
Bind leading positional arguments and default keyword arguments to a callable. Later keyword arguments override bound keywords.
Formal Syntax & Structure
python syntaxpython
functools.partial(func, /, *args, **keywords)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| func | callable | Callable applied by the operation. |
| args | object | Positional arguments. |
| keywords | object | Keyword arguments. |
Return Value
partial
The partial result described above.
Working Example
Example Snippetpython
import functoolssquare = functools.partial(pow, exp=2)print(square(5))