[Python-ideas] Re: Pickle to/from filename or path

2020-02-07 Thread Christopher Barker
Frankly, I’ve often wanted this for other things that share a similar API, JSON comes to mind. Loading from/saving to a file is a pretty common thing— nice to make it easy. And JSON at least has *s versions for strings, so no confusion there. But it’s been this way a LONG time, and with a gener

[Python-ideas] Re: Pickle to/from filename or path

2020-02-07 Thread Serhiy Storchaka
07.02.20 20:41, Antoine Pitrou пише: What you call "quite a bit of boilerplate" is just an additional line of code. If you are frequently being bothered by this (I'm curious what the context is?), it's easy to add the desired helper function to your own library. In general, I don't think adding

[Python-ideas] Re: Pickle to/from filename or path

2020-02-07 Thread Andrew Barnert via Python-ideas
> On Feb 7, 2020, at 10:21, Todd wrote: > > I think it would be nice if pickle.dump and pickle.load would also accept a > filename or path. Pickle intentionally has the same API as marshal, and so do a number of other modules—not just in the stdlib, but popular third party modules. So, I don’t

[Python-ideas] Re: Pickle to/from filename or path

2020-02-07 Thread Antoine Pitrou
On Fri, 7 Feb 2020 13:03:52 -0500 Todd wrote: > Currently with pickle you have to "open" the file separately from the > pickle operation, generally using a "with" clause, then provide the file > object to one of the pickle.dump or pickle.load. This adds quite a bit of > boilerplate for simply sav