[Python-ideas] Fwd: Re: PEP: add a `no` keyword as an alias for `not`

DL Neil PythonList at DancesWithMice.info
Fri Aug 2 18:19:43 EDT 2019


A truly marvellous aspect of Python is its world-wide spread! Many 
people use Python with greater ease than they speak or write English, 
despite Python appearing to be a sub-set of the English language!


Native English-speakers often* have difficulty following 
negatively-worded sentences, eg "if there were no sales".
(* coming from certain cultures/languages this evaluation changes to: 
"usually"!)

We, of the computing world, must become familiar with Boolean Algebra; 
and thus learn to compose a Truth-Table matrix in our heads. 
Psychologically this suggests we first seek "logic", and only thereafter 
"meaning" - is this "normal" behavior?
(humor, not question)


We are all familiar with the injunction: do not to use "double 
negatives" in a sentence, eg "I can't get no satisfaction" or "A rolling 
stone don't gather no moss"; because it confuses people - regardless of 
their English-language facility. (even more than 'big words' such as 
"facility" have the potential to reduce understanding!)


In fact, to continue analysing our own specific language-skills, when we 
double-up on something, eg a BASH switch like -vv, doesn't that mean 
'don't just -v, but do it MORE-SO'? Thus, doubling your negatives would 
mean: 'even more negative', surely? Is that what "English" says though?

NB repetition, in both a positive, or negative, sense; means "more" in 
many cultures, even good, old English: "hear, hear!".


Accordingly, I feel for the OP. Personally I dislike reading, and recoil 
from writing:

	if not something_positive:

On the other hand:

	if something_positive:
		pass
	else:
		process_the_negative

whilst acceptable, probably doesn't look or read any better.


Perhaps an answer is to use a "flag":

	no_sales_today = total_sales <= 0
	if no_sales_today:
		fire_the_sales_manager()

The descriptive variable-name IS 'negative', but the if-condition 
becomes (somewhat) positive, removes the comprehension-reducing "not", 
and the construct remains a simple if-then (ie no -else).

(it also uses "no" in the flow-of-communication, per OP's suggested 
line-of-thought)
-- 
Regards =dn



More information about the Python-list mailing list