Changeset 175


Ignore:
Timestamp:
05/22/06 16:00:11 (8 years ago)
Author:
xi
Message:

Optimize slightly the float constructor.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pyyaml/trunk/lib/yaml/constructor.py

    r173 r175  
    239239    def construct_yaml_float(self, node): 
    240240        value = str(self.construct_scalar(node)) 
    241         value = value.replace('_', '') 
     241        value = value.replace('_', '').lower() 
    242242        sign = +1 
    243243        if value[0] == '-': 
     
    245245        if value[0] in '+-': 
    246246            value = value[1:] 
    247         if value.lower() == '.inf': 
     247        if value == '.inf': 
    248248            return sign*self.inf_value 
    249         elif value.lower() == '.nan': 
     249        elif value == '.nan': 
    250250            return self.nan_value 
    251251        elif ':' in value: 
Note: See TracChangeset for help on using the changeset viewer.