summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxi <xi@18f92427-320e-0410-9341-c67f048884a3>2006-05-22 20:00:11 +0000
committerxi <xi@18f92427-320e-0410-9341-c67f048884a3>2006-05-22 20:00:11 +0000
commitcd2dffa24c1b821564e3543bfaa07e2e33fff0dc (patch)
tree3590ee36a705df6ff94f0fec5e66786f8a2f439d
parentf4d418a6ef9e87794db7a1ba985eeb07b105c314 (diff)
downloadpyyaml-cd2dffa24c1b821564e3543bfaa07e2e33fff0dc.tar.gz
Optimize slightly the float constructor.
git-svn-id: http://svn.pyyaml.org/pyyaml/trunk@175 18f92427-320e-0410-9341-c67f048884a3
-rw-r--r--lib/yaml/constructor.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/yaml/constructor.py b/lib/yaml/constructor.py
index 0d1bb19..537b76a 100644
--- a/lib/yaml/constructor.py
+++ b/lib/yaml/constructor.py
@@ -238,15 +238,15 @@ class SafeConstructor(BaseConstructor):
def construct_yaml_float(self, node):
value = str(self.construct_scalar(node))
- value = value.replace('_', '')
+ value = value.replace('_', '').lower()
sign = +1
if value[0] == '-':
sign = -1
if value[0] in '+-':
value = value[1:]
- if value.lower() == '.inf':
+ if value == '.inf':
return sign*self.inf_value
- elif value.lower() == '.nan':
+ elif value == '.nan':
return self.nan_value
elif ':' in value:
digits = [float(part) for part in value.split(':')]