You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a duplicate of #1740 — that may have been closed for lack of a clear rationale, however, and I'd like to suggest it again with the following reasoning.
The documentation currently gives this example for using open_resource():
(The type comment is needed to prevent mypy from complaining about f.read() possibly being a string with no .decode() method, as it can't tell that the file was opened in 'rb' mode.)
It would be cleaner and more flexible to be able to write:
This is a duplicate of #1740 — that may have been closed for lack of a clear rationale, however, and I'd like to suggest it again with the following reasoning.
The documentation currently gives this example for using
open_resource()
:On Windows, however, this can fail to open a file encoded in UTF-8, which most are these days, and safer code looks like this:
(The type comment is needed to prevent mypy from complaining about
f.read()
possibly being a string with no.decode()
method, as it can't tell that the file was opened in 'rb' mode.)It would be cleaner and more flexible to be able to write:
The text was updated successfully, but these errors were encountered: