R. David Murray 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
Eric Smith 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'
-
New submission from Alex Leone :
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)
'