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 natgaertner
Recipients berker.peksag, natgaertner, serhiy.storchaka
Date 2019-06-06.16:49:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1559839767.25.0.884285079773.issue36865@roundup.psfhosted.org>
In-reply-to
Content
Hey sorry for the delay in responding.

My thought with forcing 'rt' mode is that it would actually reduce the flexibility of the FileInput class. For 5758, I suspect the issue arose out of a confusion about what strings meant in python 2 vs 3. If I understand correctly, a "string" in 2 is actually an array of binary data, displayed as if it were ASCII encoded text. So when it prints the binary data from the gzip file in the example given on that issue, it's happy to say "aha this is ASCII encoded text, let's print it like a string." This leads to the case where 2 "works" (does not mark the printed data from gzip explicitly as binary).

But in 3 strings and binary arrays are totally different kinds of objects! I am unfamiliar with the history of introducing 'rt', but I'm guessing it has to do with disambiguating 'r', since text is now stored in its own unique object type and goes through an explicit encoding process to get there. With the explicit 'rt' and 'rb' modes, 'r' becomes explicitly ambiguous (an oxymoron I know), so if a user provides 'r' they are expressing no preference between text and binary. If they have a preference 'rt' and 'rb' give them the ability to express it.

I may be totally on the wrong track here, or missing some important backward compatibility issues, but that's my thoughts. Thanks!
History
Date User Action Args
2019-06-06 16:49:27natgaertnersetrecipients: + natgaertner, berker.peksag, serhiy.storchaka
2019-06-06 16:49:27natgaertnersetmessageid: <1559839767.25.0.884285079773.issue36865@roundup.psfhosted.org>
2019-06-06 16:49:27natgaertnerlinkissue36865 messages
2019-06-06 16:49:27natgaertnercreate