double

iteration_utilities.double(value, /)

Returns the doubled value.

Parameters:
valueany type

The value to be doubled..

Returns:
doubledany type

Returns value*2.

Examples

This function is equivalent to lambda x: x*2 and for numerical arguments to functools.partial(operator.mul, 2) but faster:

>>> from iteration_utilities import double
>>> double(1)
2
>>> double(2.0)
4.0