PEP 526 - var annotations and the spirit of python

Steven D'Aprano steve+comp.lang.python at
Thu Jul 5 02:58:22 EDT 2018

On Wed, 04 Jul 2018 13:26:03 -0600, Ian Kelly wrote:

>> Note that None is a special case (because sometimes special cases *are*
>> special enough to break the rules).
> I don't think this case is special enough. As a person coming along
> later and trying to read the code, I should be able to trust that the
> type hint means what it says. I should not have to go look up the rules
> of the linter to infer that in this case, type A actually means type B.

I hear what you're saying, and I neither agree nor disagree. But 
describing it as "Type A" versus "Type B" exaggerates the difference. Its 
more like "Type A" versus "Optional Type A" -- and, so the argument goes, 
it ought to be blindingly obvious from context.

> Optimize for readability, not writability.

And that is why we all hold COBOL up as the paragon of excellence for a 
programming language! *wink*

Or if you don't like COBOL, how about Hypertalk?

put 42 into x
ask file "Which file would you like to open?" with "default.txt"
if it is empty exit to Hypercard
put it into thefile
open file thefile
repeat with num = 1 to x
  write "spam" to file thefile
end repeat
close file thefile

Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson

More information about the Python-list mailing list