Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default read (open) mode is 'rb' -- shouldn't it be 'r'? #148

Closed
AndydeCleyre opened this issue Oct 2, 2014 · 1 comment
Closed

Default read (open) mode is 'rb' -- shouldn't it be 'r'? #148

AndydeCleyre opened this issue Oct 2, 2014 · 1 comment

Comments

@AndydeCleyre
Copy link
Contributor

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'.

@tomerfiliba
Copy link
Owner

you're welcome to submit pull requests. as long as the unittests pass, i'm
fine with that.

-tomer


Tomer Filiba
tomerfiliba.com http://www.facebook.com/tomerfiliba
http://il.linkedin.com/in/tomerfiliba

On Thu, Oct 2, 2014 at 11:28 PM, Andy Kluger notifications@github.com
wrote:

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants