return_identity

iteration_utilities.return_identity(obj, /)

Always return the argument.

Parameters:

obj : any type

The obj to return.

Returns:

identity : any type

The argument itself.

Examples

This function is equivalent to lambda x: x but significantly faster:

>>> from iteration_utilities import return_identity
>>> return_identity(1)
1
>>> return_identity('abc')
'abc'