[issue21071] struct.Struct.format is bytes, but should be str

Xiang Zhang report at bugs.python.org
Thu Apr 27 00:41:57 EDT 2017


Xiang Zhang added the comment:

+1 for change bytes to str. But struct.Struct() accepts both bytes and str, maybe in future buffer objects. When it gets a bytes object, converting it to a str looks unnecessary to me, and as OP said, comparison (a theoretical use case) could still fail. Could we just leave what the user passes in? bytes(bytes-like) -> bytes, str -> str. This looks more natural to me.

----------
nosy: +xiang.zhang

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


More information about the Python-bugs-list mailing list