On 2020-07-06, Chris Angelico <ros...@gmail.com> wrote: > On Mon, Jul 6, 2020 at 8:36 PM Adam Funk <a24...@ducksburg.com> wrote: >> Is there a "bulletproof" version of json.dump somewhere that will >> convert bytes to str, any other iterables to list, etc., so you can >> just get your data into a file & keep working? > > That's the PHP definition of "bulletproof" - whatever happens, no > matter how bad, just keep right on going.
While I agree entirely with your point, there is however perhaps room for a bit more helpfulness from the json module. There is no sensible reason I can think of that it refuses to serialize sets, for example. Going a bit further and, for example, automatically calling isoformat() on date/time/datetime objects would perhaps be a bit more controversial, but would frequently be useful, and there's no obvious downside that occurs to me. -- https://mail.python.org/mailman/listinfo/python-list