On Tue, Sep 15, 2020 at 12:21 AM Stephen J. Turnbull < turnbull.stephen...@u.tsukuba.ac.jp> wrote:
> > If .load and .dump are super-charged, people coding with these > > methods in mind have _one_ less_ thing to worry about: if the > > method accepts a path or an open file becomes irrelevant. > > But then you either lose the primary benefit of this three line > function (defaulting to the UTF-8 encoding to conform to the JSON > standard), or you have a situation where what encoding you get can > depend on whether you use the name of a file or that file already > opened. > I don't follow here -- either way, if you open the file yourself, then you're responsible for the encoding. and if you use a filename, then the module takes care of that for you. If anything, I think it may be less likely that people will open the file themselves incorrectly rather than passing in a file name if they are using the same function to do it. Honearly, I've been known to try to pass a filename in directly into json.load() when quickly writing code. But I didn't hear much support for the overloading option anyway, so I don't think that's going anywhere. -CHB 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/KO3ZZNTDMFZD26QGPTSNEXP2ALRDWOMF/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- Christopher Barker, PhD Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython
_______________________________________________ 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/RLXYA7H2YMUUC5LHD3HFVGH3JSNJ3WY3/ Code of Conduct: http://python.org/psf/codeofconduct/