Message93807
Python's old-style formatting supports the use of an alternative form
(specified by including a '#' in the format) for 'e', 'f' and 'g'
formatting:
Python 3.2a0 (py3k:75275:75276, Oct 7 2009, 20:26:36)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> '%.17g' % 1.2
'1.2'
>>> '%#.17g' % 1.2
'1.2000000000000000'
New-style formatting doesn't currently support this:
>>> format(1.2, '#.17g')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Alternate form (#) not allowed in float format specifier
To aid migration from old-style to new-style formatting, it might be worth
adding the alternate forms. At least the float, complex and Decimal types
would be affected. |
|
Date |
User |
Action |
Args |
2009-10-09 19:54:04 | mark.dickinson | set | recipients:
+ mark.dickinson, eric.smith |
2009-10-09 19:54:04 | mark.dickinson | set | messageid: <1255118044.58.0.727731702587.issue7094@psf.upfronthosting.co.za> |
2009-10-09 19:54:03 | mark.dickinson | link | issue7094 messages |
2009-10-09 19:54:02 | mark.dickinson | create | |
|