Changeset 150 for pyyaml/trunk/lib/yaml/representer.py
 Timestamp:
 04/23/06 14:07:52 (9 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

pyyaml/trunk/lib/yaml/representer.py
r148 r150 185 185 return self.represent_scalar(u'tag:yaml.org,2002:int', unicode(data)) 186 186 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) 189 190 190 191 def represent_float(self, data): 191 if data == self.inf_value: 192 repr_data = repr(data) 193 if repr_data == self.repr_pos_inf: 192 194 value = u'.inf' 193 elif data == self.inf_value:195 elif repr_data == self.repr_neg_inf: 194 196 value = u'.inf' 195 elif data == self.nan_value or data != data:197 elif repr_data == self.repr_nan: 196 198 value = u'.nan' 197 199 else: 198 value = unicode(repr (data))200 value = unicode(repr_data) 199 201 return self.represent_scalar(u'tag:yaml.org,2002:float', value) 200 202
Note: See TracChangeset
for help on using the changeset viewer.