[issue9951] introduce bytes.hex method

STINNER Victor report at bugs.python.org
Wed Sep 10 14:29:40 CEST 2014


STINNER Victor added the comment:

New features cannot be added to Python 2 anymore, only to the current development version which is now Python 3.5.

If new methods are added to bytes, they should be added to bytearray too. Maybe we should also consider add them to memoryview? memoryview has already a .bytes() method and can be casted to type "B" (array of integers in range 0..255).

The float type has .hex() and .fromhex() methods. We should kepe these names to stay consistent. Which kind of output do you prefer? "0xHH 0xHH ...", "HH HH HH ..." or "HHHHHH..."? Do you want to add parameters to choose the format?

Current binascii format:

>>> binascii.hexlify('abc')
'616263'

----------
nosy: +haypo

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9951>
_______________________________________


More information about the Python-bugs-list mailing list