def __call__(self, value):
decimals = pub.options.reprdigits
if isinstance(value, str):
if self._preserve_strings:
return '"%s"' % value
else:
return value
if isinstance(value, (pointerutils.Double, pointerutils.PDouble)):
value = float(value)
if ((decimals > -1) and
isinstance(value, numbers.Real) and
(not isinstance(value, numbers.Integral))):
string = '{0:.{1}f}'.format(value, decimals)
string = string.rstrip('0')
if string.endswith('.'):
string += '0'
return string
else:
return repr(value)
评论列表
文章目录