Are the critiques in "All the things I hate about Python" valid?
Terry Reedy
tjreedy at udel.edu
Sat Feb 17 03:29:49 EST 2018
On 2/16/2018 10:22 PM, boB Stepp wrote:
> This article is written by Nathan Murthy, a staff software engineer at
> Tesla. The article is found at:
> https://medium.com/@natemurthy/all-the-things-i-hate-about-python-5c5ff5fda95e
To add to what other have said:
Here is what the author said about word choice: " The word “dynamically
typed” has a positive connotation, more so than “weakly typed.”
Conversely, the word “strongly typed” sounds more positive than saying
“statically typed.” Diction matters, because proponents of different
camps will select a word-choice that reflects their bias of one
programming language over another." Exactly.
His dreadful strawperson code snippet should not be allowed even in a
beginning programming class, let alone in professional programs.
def foo(x):
if is_valid(x):
return "hello world"
else:
return bar(x)
PEP 8 recommends meaningful names and a docstring that begins with
"Return a ...". The meaningless names and lack of doc are what makes
foo hard to read, not static versus dynamic typing.
If you want to run on multiple cores, use multiple processes, either
with multiprocessing or subprocess. Module multiprocessing
intentionally has an api similar to threading, so one can convert at
least some multiple-thread programs to multiple processes and cores.
If you want safe programs, do not use unsafe weakly and statically typed
C, which allows buffer overruns if one on uses the unsafe strxxx
functions instead of the safer strnxxx functions. Buffer overruns may
still be the most common exploit of viruses and other malware.
Python coredevs try to be security conscious by adding security features
and recommending good practices. We just cannot force people to upgrade
and follow best practice.
--
Terry Jan Reedy
More information about the Python-list
mailing list