STINNER Victor <victor.stin...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue7267>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to