I'd be +1 on adding a better named alias for loading strings to all of
these libraries.

Seems to me like it is a pretty awful naming convention even if it is
standard across the profession, and that adding load_string or load_str as
an alias for loads would be a Very Good Thing (TM) with few downsides.

Two points in favor:

1. It is an obfuscated naming convention.

2. The presence of the loads() naming convention encourages people new to
coding to do the exactly wrong thing and use MORE obfuscated names for
their own methods and not less. In fact I took a cue from the standard
library and added a loads() method to my own specialized file reader (for a
soil FEA program) and regretted it later. I learned from my mistake that
descriptive names are superior, and also that naming is hard, and
thankfully it was relatively painless for me to change it.

Actually this issue has still been confusing for me sometimes even years
after first using the API, since I haven't used these libraries often and
tend not to remember it when I come back to them (this conversation will
likely make it stick in my memory better).

I even think it would be preferable for the loads() documentation to say
that it is an alias for load_str(), and not the other way around.

On Thu, Nov 28, 2019, 7:37 AM Wes Turner <wes.tur...@gmail.com> wrote:

> Maybe methods for learning to search the code and docs (rather than
> memorizing APIs) would be a worthwhile exercise?
>
> # Python
> import json
> help(json)
>
> # IPython
> !pydoc json
> import json
> json?
> json??
>
>
> # RTD: Read The Docs (and/or update the docs)
> https://docs.python.org/3/search.html?q=loads
>
> https://docs.python.org/3/library/json.html#basic-usage
>
> https://github.com/python/cpython/blob/master/Doc/library/json.rst
>
>
> # RTS: Read The Source
> https://duckduckgo.com/?q=github+cpython+json
>
> https://github.com/python/cpython/blob/master/Lib/json/__init__.py#L299
>
> https://github.com/python/cpython/tree/master/Lib/test/test_json
>
>
> On Thursday, November 28, 2019, Abdur-Rahmaan Janhangeer <
> arj.pyt...@gmail.com> wrote:
> > "Designed With Learning in Mind"
> >
> > Abdur-Rahmaan Janhangeer
> > http://www.pythonmembers.club | https://github.com/Abdur-rahmaanJ
> > Mauritius _______________________________________________
> 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/YGP2BIYBKYF5ZSFYUKVO37DQYOPYE7BO/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
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/RYCFWRSBKWKX6GVTJKCD2OEQYXGXYBEF/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to