New submission from Zbyszek Jędrzejewski-Szmek: In Python 2, Struct.format used to be a str. In Python 3 it is bytes, which is unexpected.
Why do I expect .format to be a string: - This format is pretty much the same as a "{}-format" - plain text - according to documentation it is composed of things like characters from a closed set '<.=@hi...', a subset of ASCII, - it is always called "format string" in the documentation Why is this a problem: - If I use a str format in constructor, I expect to get a str format, - Comparisons are broken: >>> struct.Struct('x').format == 'x' False >>> struct.Struct('x').format[0] == 'x' False - doctests are broken >>> struct.Struct('x').format 'x' # in Python 2 b'x' # in Python 3 ---------- components: Library (Lib) messages: 214903 nosy: zbysz priority: normal severity: normal status: open title: struct.Struct.format is bytes, but should be str type: behavior versions: Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21071> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com