This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients eric.smith, mark.dickinson
Date 2009-10-09.19:54:02
SpamBayes Score 1.0530465e-13
Marked as misclassified No
Message-id <1255118044.58.0.727731702587.issue7094@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2009-10-09 19:54:04mark.dickinsonsetrecipients: + mark.dickinson, eric.smith
2009-10-09 19:54:04mark.dickinsonsetmessageid: <1255118044.58.0.727731702587.issue7094@psf.upfronthosting.co.za>
2009-10-09 19:54:03mark.dickinsonlinkissue7094 messages
2009-10-09 19:54:02mark.dickinsoncreate