[issue3982] support .format for bytes
Martin v. Löwis
report at bugs.python.org
Sat Jul 11 18:47:35 CEST 2009
Martin v. Löwis <martin at v.loewis.de> added the comment:
> hex(10) returns '0xa' instead of 'a'.
Ah, right. So I would still use
'{0:x}'.format(100).encode("ascii")
rather than the format builtin format function. Actually, I would
probably use
('%x' % len(bytes)).encode("ascii")
> The point is that need to convert to ascii for each int that you send.
> You cannot just wrap the socket with an encoding. This makes porting
> difficult.
This I don't understand. What porting becomes more difficult?
>From 2.x to 3.x? Why do you have any .format calls in your code that you
want to port - .format was only added in 2.6, so if you want to support
2.x, you surely are not using .format, are you?
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3982>
_______________________________________
More information about the Python-bugs-list
mailing list