On Fri, Sep 11, 2020 at 4:19 PM David Mertz <me...@gnosis.cx> wrote:

> On Fri, Sep 11, 2020, 12:59 PM Guido van Rossum <gu...@python.org> wrote:
>
>> What happened to "not every three-line function needs to be a built-in"?
>> This is *literally* a three-line function. And I know the proposal is not
>> to make it a builtin, but still... ISTM down here lies the path to PHP.
>>
>
> By the same reasoning, though, if you have dumps(), writing dump() in
> terms of it is a three-line function. Same in the venerable pickle versions.
>

Not quite -- if the serialized data is really huge it makes sense to read
or write it directly from/to a file, rather than building up a gigantic
in-memory buffer as an intermediate structure. (And going in the other
direction, if all you have is load/dump, constructing an io.StringIO
instance is a fairly awkward bit of idiom.

But I'm convinced by Inada's observation that it's easy to have
encoding-related bugs -- we should add this in a way that avoids those. And
I'm fine with loadf/dumpf as the names, since we already have loads/dumps.

-- 
--Guido van Rossum (python.org/~guido)
*Pronouns: he/him **(why is my pronoun here?)*
<http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/N77PUNWOPG7YKL5CFXQHVXP5WB7TXAGA/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to