[issue28927] bytes.fromhex should ignore all whitespace

Terry J. Reedy report at bugs.python.org
Fri Dec 16 18:27:38 EST 2016


Terry J. Reedy added the comment:

I am a bit dubious about this.  There is a tradeoff here between convenience and bug detection.  The patch is not strictly necessary.

>>> bytes.fromhex('ab\ncd'.replace('\n', ''))
b'\xab\xcd'

Bytes (and bytearray) .fromhex already ignores spaces.  Not ignoring newlines, by default, may have been intentional.  Nick, you wrote the doc entry for 'fromhex'.  Do you know anything about the design intention?

----------
nosy: +ncoghlan, terry.reedy

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


More information about the Python-bugs-list mailing list