New submission from Vedran Čačić:
Look at this:
>>> format("ab", "^3"), "ab".center(3)
('ab ', ' ab')
>>> format("abc", "^4"), "abc".center(4)
('abc ', 'abc ')
I'm sure you agree this is inconsistent. As far as I can see, format relies on
// (flooring) behaviour when dividing remaining space by 2, while .center
relies on round (ROUND_HALF_EVEN) behaviour. One of them should be changed to
match the other.
As far as I can see, documentation (in neither case) says nothing about how
_exactly_ strings are centered when there is an odd number of fill characters,
so I would interpret this as: we can change either. (My preference is for
.center to be changed, but this is not so important. Consistency is important.)
----------
messages: 237729
nosy: Vedran.Čačić
priority: normal
severity: normal
status: open
title: str.center inconsistent with format "^"
type: behavior
versions: Python 3.4
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue23624>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com