Ignore:
Timestamp:
04/23/06 14:07:52 (8 years ago)
Author:
xi
Message:

Prepare setup.py for release. Fix #7.

File:
1 edited

Legend:

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

    r148 r150  
    185185        return self.represent_scalar(u'tag:yaml.org,2002:int', unicode(data)) 
    186186 
    187     inf_value = 1e300000 
    188     nan_value = inf_value/inf_value 
     187    repr_pos_inf = repr(1e300000) 
     188    repr_neg_inf = repr(-1e30000) 
     189    repr_nan = repr(1e300000/1e300000) 
    189190 
    190191    def represent_float(self, data): 
    191         if data == self.inf_value: 
     192        repr_data = repr(data) 
     193        if repr_data == self.repr_pos_inf: 
    192194            value = u'.inf' 
    193         elif data == -self.inf_value: 
     195        elif repr_data == self.repr_neg_inf: 
    194196            value = u'-.inf' 
    195         elif data == self.nan_value or data != data: 
     197        elif repr_data == self.repr_nan: 
    196198            value = u'.nan' 
    197199        else: 
    198             value = unicode(repr(data)) 
     200            value = unicode(repr_data) 
    199201        return self.represent_scalar(u'tag:yaml.org,2002:float', value) 
    200202 
Note: See TracChangeset for help on using the changeset viewer.