[Python-ideas] `to_file()` method for strings

Nick Coghlan ncoghlan at gmail.com
Wed Mar 23 02:45:52 EDT 2016


On 23 March 2016 at 15:44, Nick Eubank <nickeubank at gmail.com> wrote:
> True -- my feeling is that if we're ok with defaults in a pathlib method,
> why not put them in a string method?

pathlib is explicitly about filesytem management and manipulation,
while strings don't inherently have anything to do with filesystems,
and only a little bit to do with serialisation (via str.encode).

Having some lower level convenience functions in io may make sense
(specifically io.write_bytes(path, data) and io.write_text(path, data,
encoding=None, errors=None), but the str builtin definitely isn't the
right place for the capability.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-ideas mailing list