|
|
Subscribe / Log in / New account

Re: `to_file()` method for strings

From:  Nick Coghlan <ncoghlan-Re5JQEeQqe8AvxtiuMwx3w-AT-public.gmane.org>
To:  Nick Eubank <nickeubank-Re5JQEeQqe8AvxtiuMwx3w-AT-public.gmane.org>
Subject:  Re: `to_file()` method for strings
Date:  Wed, 23 Mar 2016 16:45:52 +1000
Message-ID:  <CADiSq7f=mdaN5P8+rd92Cjw_10TXGnfynEaOnS8qJ+v=sXL-LQ@mail.gmail.com>
Cc:  "python-ideas-+ZN9ApsXKcEdnm+yROfE0A-AT-public.gmane.org" <python-ideas-+ZN9ApsXKcEdnm+yROfE0A-AT-public.gmane.org>

On 23 March 2016 at 15:44, Nick Eubank <nickeubank-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org   |   Brisbane, Australia
_______________________________________________
Python-ideas mailing list
Python-ideas-+ZN9ApsXKcEdnm+yROfE0A@public.gmane.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/




to post comments


Copyright © 2016, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds