Changeset 173 for pyyaml/trunk/lib/yaml/representer.py
 Timestamp:
 05/22/06 15:49:54 (8 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

pyyaml/trunk/lib/yaml/representer.py
r168 r173 196 196 while repr(inf_value) != repr(inf_value*inf_value): 197 197 inf_value *= inf_value 198 nan_value = inf_value/inf_value199 200 repr_pos_inf = repr(inf_value)201 repr_neg_inf = repr(inf_value)202 repr_nan = repr(inf_value/inf_value)203 198 204 199 def represent_float(self, data): 205 repr_data = repr(data) 206 if repr_data == self.repr_pos_inf: 200 if data != data or (data == 0.0 and data == 1.0): 201 value = u'.nan' 202 elif data == self.inf_value: 207 203 value = u'.inf' 208 elif repr_data == self.repr_neg_inf:204 elif data == self.inf_value: 209 205 value = u'.inf' 210 elif repr_data == self.repr_nan: 211 value = u'.nan' 212 else: 213 value = unicode(repr_data) 206 else: 207 value = unicode(repr(data)) 214 208 return self.represent_scalar(u'tag:yaml.org,2002:float', value) 215 209
Note: See TracChangeset
for help on using the changeset viewer.