[issue7267] format method: c presentation type broken
STINNER Victor
report at bugs.python.org
Sat Jan 23 01:46:35 CET 2010
STINNER Victor <victor.stinner at haypocalc.com> added the comment:
('%c' % 255) == chr(255) == '\xff'
'%c' % 256 raise an "OverflowError: unsigned byte integer is greater than maximum" and chr(256) raise a "ValueError: chr() arg not in range(256)". I prefer the second error ;-)
str.format() should follow the same behaviour.
str is a byte string: it can be used to create a network packet or encode data into a byte stream. '%c' is useful for that, and str.format() should keep this nice feature.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7267>
_______________________________________
More information about the Python-bugs-list
mailing list