From 71e5b09c8bc6e7a62e3dd9e2043b1eb204f2ee5a Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rg=20Lehmann?= Date: Sun, 25 Jan 2004 13:27:16 +0000 Subject: [PATCH] microoptimisation: change order of elifs to treat more common case first git-svn-id: https://pyx.svn.sourceforge.net/svnroot/pyx/trunk/pyx@1309 069f4177-920e-0410-937b-c2a4a81bcd90 --- pyx/unit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyx/unit.py b/pyx/unit.py index da706836..fbdcc870 100644 --- a/pyx/unit.py +++ b/pyx/unit.py @@ -111,6 +111,8 @@ class length: if isinstance(l, length): self.length = l.length + elif helper.isnumber(l): + self.length[default_type] = l*_m[dunit or _default_unit] elif helper.isstring(l): unit_match = re.match(unit_pattern, l) if unit_match is None: @@ -121,8 +123,6 @@ class length: self.unit_name = unit_match.group(9) or dunit or _default_unit self.length[self.unit_type] = self.prefactor*_m[self.unit_name] - elif helper.isnumber(l): - self.length[default_type] = l*_m[dunit or _default_unit] else: raise ( NotImplementedError, "cannot convert given argument to length type" ) -- 2.11.4.GIT