"platforms/vscode:/vscode.git/clone" did not exist on "a4673043ad80d68e59f6edbbb7a94f1b3cd97c98"
Commit f6d90066 authored by Jason Swails's avatar Jason Swails
Browse files

Possible speedup for unit_math.sum function.

parent 9c38d980
......@@ -156,6 +156,10 @@ def sum(val):
>>> sum((2.0*meter, 30.0*centimeter))
Quantity(value=2.3, unit=meter)
"""
try:
return val.sum()
except AttributeError:
pass
if len(val) == 0:
return 0
result = val[0]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment