[issue3446] center, ljust and rjust are inconsistent with unicode parameters

2010-12-15 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : -- status: pending -> closed ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: h

[issue3446] center, ljust and rjust are inconsistent with unicode parameters

2010-12-06 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: As a feature request for 2.x, I think this should be rejected. Any objections? The "behavior" part seem to have been fixed. -- assignee: -> belopolsky nosy: +belopolsky resolution: -> rejected status: open -> pending type: behavior -> feature

[issue3446] center, ljust and rjust are inconsistent with unicode parameters

2009-05-04 Thread STINNER Victor
STINNER Victor added the comment: The question is why str.{ljust,rjust,center} doesn't accept unicode argument, whereas unicode.{ljust,rjust,center} accept ASCII string. Other string methods accept unicode argument, like str.count() (encode the unicode string to bytes using utf8 charset). To

[issue3446] center, ljust and rjust are inconsistent with unicode parameters

2009-05-04 Thread STINNER Victor
STINNER Victor added the comment: This issue only concerns Python 2.x, Python 3.x has the right behaviour: it disallow mixing bytes with characters. -- versions: +Python 2.7 -Python 2.4, Python 2.5, Python 3.0 ___ Python tracker

[issue3446] center, ljust and rjust are inconsistent with unicode parameters

2009-05-04 Thread STINNER Victor
STINNER Victor added the comment: haypo> About Python3, bytes.center accepts unicode as second argument, haypo> which is an error for me Ok, it's fixed thanks by r71013 (issue #5499). -- ___ Python tracker ___

[issue3446] center, ljust and rjust are inconsistent with unicode parameters

2009-03-17 Thread STINNER Victor
STINNER Victor added the comment: About Python3, bytes.center accepts unicode as second argument, which is an error for me: >>> b"x".center(5, b"\xe9") b'\xe9\xe9x\xe9\xe9' >>> b"x".center(5, "\xe9") b'\xe9\xe9x\xe9\xe9' The second example must fail with a TypeError. str.center has the right

[issue3446] center, ljust and rjust are inconsistent with unicode parameters

2009-02-23 Thread Raymond Hettinger
Raymond Hettinger added the comment: In Py2.x, I think the desired behavior should match str.join(). If either input in unicode the output is unicode. If both are ascii, ascii should come out. For Py3.x, I think the goal was to have str.join() enforce that both inputs are unicode. If either

[issue3446] center, ljust and rjust are inconsistent with unicode parameters

2009-02-19 Thread Ezio Melotti
Ezio Melotti added the comment: Indeed this behavior doesn't seem to be documented. When the string is unicode and the fillchar non-unicode Python implicitly tries to decode the fillchar (and possibly it raises a TypeError if it's not in range(0,128)): >>> u'x'.center(5, 'y') # unicode string,

[issue3446] center, ljust and rjust are inconsistent with unicode parameters

2008-07-25 Thread Ignas Mikalajūnas
New submission from Ignas Mikalajūnas <[EMAIL PROTECTED]>: Not all combinations of unicode/non-unicode parameters work for ljust, center and rjust. Passing a unicode character to them as a parameter when the string is ascii fails with an error. This doctest fails in 3 places. Though I would expe