str() inconsistency

Mike Rovner mike at bindkey.com
Thu Jul 25 20:20:24 EDT 2002


Why it's not a bug:

>>> 4.4
4.4000000000000004
>>> `4.4`
'4.4000000000000004'
>>> str(4.4)
'4.4'
>>> str([4.4])
'[4.4000000000000004]'

IMHO, str() shall call str, not repr on complex objects.

Regards,
Mike









More information about the Python-list mailing list