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
The default file opening mode in python is 'r', which results in read calls returning a str. This is reasonable, because that's what happens most of the time -- we open a text file to see what's in it.
Every time I use plumbum's read method on a file, I have to convert the result from bytes to a str explicitly. Don't most people want a string when they call that method? I suggest that your read either always pass 'r' to your open, or that it take an optional mode parameter that defaults to 'r'.
The text was updated successfully, but these errors were encountered:
The default file opening mode in python is 'r', which results in read
calls returning a str. This is reasonable, because that's what happens
most of the time -- we open a text file to see what's in it.
Every time I use plumbum's read method on a file, I have to cast the
result as a str explicitly. Don't most people want a string when they
call that method? I suggest that your read either always pass 'r' to your
open, or that it take an optional mode parameter that defaults to 'r'.
—
Reply to this email directly or view it on GitHub #148.
The default file
open
ing mode in python is'r'
, which results inread
calls returning astr
. This is reasonable, because that's what happens most of the time -- we open a text file to see what's in it.Every time I use plumbum's
read
method on a file, I have to convert the result from bytes to astr
explicitly. Don't most people want a string when they call that method? I suggest that yourread
either always pass'r'
to youropen
, or that it take an optionalmode
parameter that defaults to'r'
.The text was updated successfully, but these errors were encountered: