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

2010-12-05 Thread Alex Leone

New submission from Alex Leone acle...@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 rep...@bugs.python.org
http://bugs.python.org/issue10633
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2010-12-05 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

I disagree that your expected output is how it should behave. I believe it's 
more likely that the user wants the entire field width specified. In addition, 
compatibility with %-formatting would dictate that we keep the current behavior.

  '%#02x' % 10
'0xa'

--
nosy: +eric.smith

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10633
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2010-12-05 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Eric, I'm assuming you just forgot to close this.  On the other hand, if you 
wanted a +1 from another dev, you've got it :)  Besides the considerations you 
mentioned, changing this would be a significant backward incompatibility, and 
is therefore pretty much ruled out at this point, no matter what anyone might 
want.

--
nosy: +r.david.murray
resolution:  - invalid
stage:  - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10633
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com