2014/1/8 Ethan Furman <et...@stoneleaf.us>: >> Therefore you shouldn't accept integers. It does not make sense to >> format 4 as b'4'. > > Agreed. I would have that it would result in b'\x04'.
The PEP proposes b'%c' % 4 => b'\x04. Antoine gave me a good argument against supporting b'%s' % int: how would int subclasses be handled? int has no __bytes__() nor __bformat__() method. bytes(int) returns a string of null bytes. I'm maybe simpler to only support %s format with bytes-like objects (bytes, bytearray, memoryview). Victor _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com