
On Fri, Sep 11, 2020 at 4:19 PM David Mertz <mertz@gnosis.cx> wrote:
On Fri, Sep 11, 2020, 12:59 PM Guido van Rossum <guido@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-c...>