This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author zbysz
Recipients zbysz
Date 2014-03-26.17:48:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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'
>>> struct.Struct('x').format[0] == 'x'

- doctests are broken
>>> struct.Struct('x').format
'x' # in Python 2
b'x' # in Python 3
Date User Action Args
2014-03-26 17:48:53zbyszsetrecipients: + zbysz
2014-03-26 17:48:53zbyszsetmessageid: <>
2014-03-26 17:48:53zbyszlinkissue21071 messages
2014-03-26 17:48:53zbyszcreate