On Thu, Nov 28, 2019 at 06:18:11PM -0500, Ricky Teachey wrote:
> Leading by example of not sticking forever with obfuscated naming.
"loads" is not obfuscated naming. It has an easy-to-remember (if not
totally obvious) meaning once you realise it is supposed to be
pronounced as "load-s" (s for string) rather than "loads".
json.xtagbe would be obfuscated naming. Or json._9263, or json.pencil.
Python uses close-to natural language identifiers. And we need to learn
how to correctly parse natural language identifiers: the os module is "o
s", not "os sounds like aus or oz". "thread" is "th-red", not "th-read".
English spelling is weird and inconsistent, with dozens or more of
homonyms and homographs, like:
project, bat, lie, fair, second, fine (homonyms)
refuse, resume, minute (homographs)
etc. "loads" is a homograph, as it can be read as
loads (as in "he loads the dishwasher")
or
load-s (s for string).
There may be languages with a perfectly rational and consistent
relationship between written symbols and sounds, but I don't know of
any. (And I'd expect that such a language would either have a very large
number of symbols, or support only a very small fraction of the sounds
that human speach can make.) For good or ill, if we want our code to
look even a little bit like English, we're going to need to deal with
the complexity of English spelling.
Programming uses lots of initialisms, abbreviations and hybrid words,
such as:
os ram ssd dir json xml len chr EOF I/O rlcompleter pprint sqlite
etc, and loads is not particularly worse than the rest.
> So I'm still +1. Just add the better named function as an option and be
> done with it; other than adding it to the docs, leave everything else as it
> is. New people will start using it (because it is so much more obvious what
> it is) and their understanding, and the new code they write mimicking the
> standard library, will be improved. And later other libraries will follow
> the lead that better names for things are very very important.
I dispute that the alternative is a "better" name. Better for who?
Better in what way?
Forcing newbies to learn *two* names for the same method does not sound
like an improvement to me. You say "leave everything else as it is", so
newcomers will still see the old name in code, in tutorials, in blog
posts, in books, on Stackoverflow answers, etc. So they still have to
learn that "loads" is "load s(tring)".
Effectively you are swapping one problem:
"what's the difference between load and loads?"
for two problems:
"what's the difference between load and loads?"
"what's the difference between loads and load_string?"
--
Steven
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/LBBD64XTBW2QCZ6PCB3HRCYBCRME7Q2H/
Code of Conduct: http://python.org/psf/codeofconduct/