[Python-Dev] Float formatting and # (original) (raw)
Georg Brandl g.brandl at gmx.net
Fri Apr 28 21:31:24 CEST 2006
- Previous message: [Python-Dev] PyThreadState_SetAsyncExc and native extensions
- Next message: [Python-Dev] Float formatting and #
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Is there a reason why the "alternate format" isn't documented for float conversions in http://docs.python.org/lib/typesseq-strings.html ?
'%#8.f' % 1.0 keeps the decimal point while '%8.f' % 1.0 drops it.
Also, for %g the alternate form keeps trailing zeroes.
While at it, I noticed a difference between %f and %g:
'%.3f' % 1.123 is "1.123" while '%.3g' % 1.123 is "1.12".
Is that intentional?
Georg
- Previous message: [Python-Dev] PyThreadState_SetAsyncExc and native extensions
- Next message: [Python-Dev] Float formatting and #
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]