Revision 7656
Added by Aaron Marcuse-Kubitza over 11 years ago
lib/units.py | ||
---|---|---|
64 | 64 |
# can't convert quantity with unknown units |
65 | 65 |
else: raise NotImplementedError('Unit conversion not implemented yet') |
66 | 66 |
else: |
67 |
return Quantity(str(format.str2float(quantity.value)*conversion), units) |
|
67 |
for try_num in xrange(2): |
|
68 |
try: |
|
69 |
value = format.str2float(quantity.value) |
|
70 |
break |
|
71 |
except ValueError: quantity.value = parse_range(quantity.value)[0] |
|
72 |
return Quantity(str(value*conversion), units) |
Also available in: Unified diff
units.py: convert(): Support ranges