[Python-ideas] `pathlib.Path.write` and `pathlib.Path.read`

Antoine Pitrou solipsis at pitrou.net
Sun Jan 5 18:53:16 CET 2014


On Sat, 4 Jan 2014 14:41:01 -0800 (PST)
Ram Rachum <ram.rachum at gmail.com> wrote:
> 
> This will be super useful to me. Many files actions are one liners like 
> that, and avoiding putting the `with` clause in user code would be 
> wonderful.
> 
> What do you think? 

I agree something like that would be useful, I'm just not sure what the
ideal API would be. For starters I think "binary" shouldn't be an
argument: there should be separate methods for reading/writing text and
binary contents. Also, you need to be able to pass encoding and other
parameters for text files.

Regards

Antoine.




More information about the Python-ideas mailing list