[issue43297] bz2.open modes behaving differently than standard open() modes

2021-02-22 Thread Philipp Freyer


New submission from Philipp Freyer :

The documentation clearly states that bz2.open(mode='r') opens a file in binary 
mode. I would have to use 'rt' for text mode.

The basic Python open(mode='r') method opens a file in text mode.
This is how I would expect any open(mode='r') method to work, especially since 
the standard Python implementation of open() treats 'r' as a synonym to 'rt'.

IMHO the behavior of bz2.open() is a possible pitfall for many developers and 
should be in line with the standard open() behavior.

Sorry, if this is in the wrong place, I am happy to put this elsewhere. 
However, I do see that as a conceptual issue (in our case this bug was not 
found for years)

--
messages: 387517
nosy: philipp.freyer
priority: normal
severity: normal
status: open
title: bz2.open modes behaving differently than standard open() modes
type: behavior
versions: Python 3.9

___
Python tracker 
<https://bugs.python.org/issue43297>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43297] bz2.open modes behaving differently than standard open() modes

2021-02-23 Thread Philipp Freyer


Philipp Freyer  added the comment:

I understand and accept that but I would recommend highlighting this difference 
in the documentation a bit more since this information can be easily skipped 
when reading the documentation.

I still find it important to hint to this stronger since I've seen countless 
code snippets and answers on Stackoverflow that either tell the user to use "r" 
for text mode and "rb" for binary or - if listing file open modes do not 
mention the "*t" modes at all.

If you can point me to where to suggest a change (or pull request) for the 
documentation, I am happy to propose a change myself :-)

--

___
Python tracker 
<https://bugs.python.org/issue43297>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com