str() inconsistency

Delaney, Timothy tdelaney at avaya.com
Thu Jul 25 23:10:47 EDT 2002


> From: Mike Rovner [mailto:mike at bindkey.com]
> 
> 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.

http://www.python.org/cgi-bin/faqw.py?req=show&file=faq04.098.htp

Tim Delaney




More information about the Python-list mailing list