[New-bugs-announce] [issue10633] string.format() Unexpected output with numeric '#' prefix and 0 width

Alex Leone report at bugs.python.org
Mon Dec 6 00:40:51 CET 2010


New submission from Alex Leone <acleone at gmail.com>:

When using the '#' to prefix a numeric argument in format() with a '0x' or others, the 0-width padding takes into account the '0x' characters.  This is unexpected - the 0-width should NOT take into account the prefix.

Current Behavior:
> "{0:#02x}".format(10)
'0xa'

Expected Output:
> "{0:#02x}".format(10)
'0x0a'

(note that the '0a' is two characters long, as it should be)

----------
components: Library (Lib)
messages: 123441
nosy: Alex.Leone
priority: normal
severity: normal
status: open
title: string.format() Unexpected output with numeric '#' prefix and 0 width
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10633>
_______________________________________


More information about the New-bugs-announce mailing list