We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b33ba05 commit d35fa2eCopy full SHA for d35fa2e
lib/matplotlib/cbook.py
@@ -1620,7 +1620,6 @@ def safe_first_element(obj):
1620
"""
1621
return _safe_first_finite(obj, skip_nonfinite=False)
1622
1623
-_NoValue = object()
1624
1625
def _safe_first_finite(obj, *, skip_nonfinite=True):
1626
@@ -1664,11 +1663,10 @@ def safe_isfinite(val):
1664
1663
raise RuntimeError("matplotlib does not "
1665
"support generators as input")
1666
else:
1667
- value = next((val for val in obj if safe_isfinite(val)), _NoValue)
1668
- if value is _NoValue:
1669
- return safe_first_element(obj)
1670
- else:
1671
- return value
+ for val in obj:
+ if safe_isfinite(val):
+ return val
+ return safe_first_element(obj)
1672
1673
1674
def sanitize_sequence(data):
0 commit comments