Issue 7081: ">" formatting behaving like "=" formatting (original) (raw)

Issue7081

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/51330

classification

Title: ">" formatting behaving like "=" formatting
Type: behavior Stage:
Components: Versions: Python 3.2, Python 2.7

process

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 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg93738 - (view) Author: Alyssa 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") '+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.
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: Alyssa 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.
History
Date User Action Args
2022-04-11 14:56:53 admin set github: 51330
2009-10-08 12:26:32 ncoghlan set status: open -> closedresolution: duplicatesuperseder: Built-in types format incorrectly with 0 padding.messages: +
2009-10-08 12:11:27 eric.smith set messages: +
2009-10-08 11:48:43 mark.dickinson set nosy: + mark.dickinsonmessages: +
2009-10-08 11:37:46 ncoghlan create