mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-25 03:08:27 +08:00
units: support direct float conversion
This commit is contained in:
parent
021d0d312e
commit
61dc177bce
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user