# square¶

iteration_utilities.square(value, /)

Returns the squared value.

Parameters: value : any type The value to be squared. The type of the value must support pow. square : any type Returns value**2.

Examples

It is not possible to apply functools.partial() to pow() so that one has a one-argument square function and is significantly faster than lambda x: x**2:

>>> from iteration_utilities import square
>>> square(1)
1
>>> square(2.0)
4.0