[issue7081] ">" formatting behaving like "=" formatting

Nick Coghlan report at bugs.python.org
Thu Oct 8 13:37:48 CEST 2009


New submission from Nick Coghlan <ncoghlan at gmail.com>:

The ">" alignment flag to format() is not right aligning numbers
properly on trunk and the py3k branch:

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

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

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.

----------
assignee: eric.smith
messages: 93738
nosy: eric.smith, ncoghlan
priority: normal
severity: normal
status: open
title: ">" formatting behaving like "=" formatting
type: behavior
versions: Python 2.7, Python 3.2

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


More information about the Python-bugs-list mailing list