forked from M-Labs/artiq
1
0
Fork 0

units: support direct float conversion

This commit is contained in:
Sebastien Bourdeauducq 2015-02-16 07:48:05 -07:00
parent 021d0d312e
commit 61dc177bce
1 changed files with 3 additions and 0 deletions

View File

@ -117,6 +117,9 @@ class Quantity:
else:
return str(r_amount) + " " + self.unit
def __float__(self):
return float(self.amount)
# mul/div
def _binop(self, other, opf_name, dim_function):
opf = getattr(self.amount, opf_name)