[New-bugs-announce] [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")
>>> 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.

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>

More information about the New-bugs-announce mailing list