Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 99d481b

Browse files
committed
Make clamp use a ternary.
1 parent 375ed00 commit 99d481b

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

lib/matplotlib/_mathtext.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,11 +1707,7 @@ def ship(ox, oy, box):
17071707
off_v = oy + box.height
17081708

17091709
def clamp(value):
1710-
if value < -1000000000.:
1711-
return -1000000000.
1712-
if value > 1000000000.:
1713-
return 1000000000.
1714-
return value
1710+
return -1e9 if value < -1e9 else +1e9 if value > +1e9 else value
17151711

17161712
def hlist_out(box):
17171713
nonlocal cur_v, cur_h, off_h, off_v

0 commit comments

Comments
 (0)