[issue40382] Make 'rt' the default for open in docs

Terry J. Reedy report at bugs.python.org
Fri May 1 16:43:05 EDT 2020


Terry J. Reedy <tjreedy at udel.edu> added the comment:

The inconsistency might be a residue of the transition from 2.x.  But the 'r' versus 'rt' confusion originates in the code and signature.   The text 't' default is built into the code, while the read 'r' default is in the 'mode=r' part of the signature.

If text 't' were only a signature default, from 'mode=rt', then changing 'read-text' to 'something_else-text' would require including the 't', as in 'wt', etc.  But it is not.  On the other hand, passing mode as 'b' or using 'mode=b' is a ValueError because one of 'r', 'w', or 'a', optionally followed by '+', is required.

I think the doc entry for open might stand a change to make this a bit clearer, but I don't have a specific proposal yet.

----------
nosy: +terry.reedy

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40382>
_______________________________________


More information about the Python-bugs-list mailing list