Title: ">" formatting behaving like "=" formatting
Type: behavior Stage:
Components: Versions: Python 3.2, Python 2.7
Status: closed Resolution: duplicate
Dependencies: Superseder: Built-in types format incorrectly with 0 padding.
View: 6902
Assigned To: eric.smith Nosy List: eric.smith, mark.dickinson, ncoghlan
Priority: normal Keywords:

Created on 2009-10-08 11:37 by ncoghlan, last changed 2009-10-08 12:26 by ncoghlan. This issue is now closed.

Messages (4)
msg93738 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2009-10-08 11:37
The ">" alignment flag to format() is not right aligning numbers
properly on trunk and the py3k branch:

>>> format(0x1234, "+#08x")
>>> format(0x1234, "0=+#8x")
>>> format(0x1234, "0>+#8x")

That last one should be:
>>> format(0x1234, "0>+#8x")

The intended behaviour of ">" is more obviously correct when you
consider a leading space instead of a leading zero:

>>> format(0x1234, " >+#8x")
' +0x1234'

This is only an error on the development versions - the behaviour is
correct on the 2.6 and 3.1 maintenance branches.
msg93739 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2009-10-08 11:48
Is this the same problem as in issue 6902?
msg93740 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2009-10-08 12:11
I think they're the same issue, relating to what happens if there's an
alignment specifier supplied along with '0'. I'm planning on working on
this issue this weekend and I'll verify if it's the same problem.
msg93741 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2009-10-08 12:26
Just checked, and yep, it's a duplicate of 6902 - the problem does
indeed go away if I use a different formatting character.
Date User Action Args
2009-10-08 12:26:32ncoghlansetstatus: open -> closed
resolution: duplicate
superseder: Built-in types format incorrectly with 0 padding.
messages: + msg93741
2009-10-08 12:11:27eric.smithsetmessages: + msg93740
2009-10-08 11:48:43mark.dickinsonsetnosy: + mark.dickinson
messages: + msg93739
2009-10-08 11:37:46ncoghlancreate