[issue34955] passing a dict to bytes() gives unhelpful error message

Eric V. Smith report at bugs.python.org
Wed Oct 10 18:22:11 EDT 2018


Eric V. Smith <eric at trueblade.com> added the comment:

You can in fact pass a dict to bytes(), as long as the keys are ints in the correct range:

>>> bytes({0:10, 1:20})
b'\x00\x01'

I'm not claiming it's very useful, but it does conform to the docs. I'm not sure the error message can be improved, so I suggest closing this issue.

----------
nosy: +eric.smith

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34955>
_______________________________________


More information about the Python-bugs-list mailing list