From 61dc177bce99702588a18874acd98997fd48d911 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 16 Feb 2015 07:48:05 -0700 Subject: [PATCH] units: support direct float conversion --- artiq/language/units.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/artiq/language/units.py b/artiq/language/units.py index 88451c402..cb912014e 100644 --- a/artiq/language/units.py +++ b/artiq/language/units.py @@ -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)