mirror of https://github.com/mahmoud/boltons.git
add an example using default arguments of clamp
This commit is contained in:
parent
4bae3f5589
commit
91de0cb298
|
@ -23,6 +23,8 @@ def clamp(x, lower=float('-inf'), upper=float('inf')):
|
||||||
0
|
0
|
||||||
>>> clamp(101.0, 0, 5)
|
>>> clamp(101.0, 0, 5)
|
||||||
5
|
5
|
||||||
|
>>> clamp(123, upper=5)
|
||||||
|
5
|
||||||
|
|
||||||
Similar to `numpy's clip`_ function.
|
Similar to `numpy's clip`_ function.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue