Author zbysz
Recipients zbysz
Date 2014-03-26.17:48:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1395856133.5.0.672707015318.issue21071@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2014-03-26 17:48:53zbyszsetrecipients: + zbysz
2014-03-26 17:48:53zbyszsetmessageid: <1395856133.5.0.672707015318.issue21071@psf.upfronthosting.co.za>
2014-03-26 17:48:53zbyszlinkissue21071 messages
2014-03-26 17:48:53zbyszcreate