Dennis Lee Bieber wrote:
> On Wed, 13 Feb 2008 17:49:08 -0800, Jeff Schwab <[EMAIL PROTECTED]>
> declaimed the following in comp.lang.python:
> 
>> If you need a pretty string for use in code:
>>
>>      >>> def pretty_fp(fpnum, prec=8):
>>      ...     return ('%.8f' % fpnum).rstrip('0')
>>      ...
>>      >>> pretty_fp(0.3)
>>      '0.3'
>>
> 
>       What's wrong with just
> 
>       str(0.3)

Nothing!

> that's what "print" invokes, whereas the interpreter prompt is using 
> 
>       repr(0.3)

Thanks for pointing that out.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to