Skip to content

➰ Functional

Utilities for functional programming.

identity

Takes a single object and returns it right away.

Other open source libraries provide it, but current implementation stands out thanks to proper typing via TypeVar.

It helps an IDE to automatically highlight errors like this:

highlighted_error.py
from utilsx.functional import identity

number = identity(3)
text = identity("apple")

# IDE warns about this guaranteed TypeError
combo = number + text