not in

rihad rihad at mail.ru
Mon Jan 21 13:03:46 EST 2002


On Mon, 21 Jan 2002 17:36:14 +0100, "Alex Martelli" <aleax at aleax.it>
wrote:

>"rihad" <rihad at mail.ru> wrote in message
>news:etfo4u8d8d1tv66shloq3d5j57je1kg3h7 at 4ax.com...
>    ...
>> Hmm, alert, sarcasm detected :) While `not a and not b' vs. `not (a or
>> b)' is an application of language-neutral DeMorgan theorem, and `2 + 3
>> == 5' vs '3 + 2 == 5' have this icky commutative property :), `not in'
>> and `is not' are really keywords on their own. Please don't get me
>
>Sure, "not in" is not a keyword -- it's the combination of two
>keywords (into one operator), 

But its semantics are those of a /single/ keyword.

> Why should
>Python invent new single-keywords, when pair of keywords can
>combine readably and efficiently?  I keep missing your point.
>

If it's all about readability, Python should require `is' after `if',
as in if x is in sequence

I'm not advocating is_not/not_in, and I don't count the equivalence of
x not in s/not (x in s) as a flaw - it's a decision, after all :) As
someone else noted, the former form even helps the compiler to
generate better code, which is all good. Perhaps that was the original
intent of the `not in' "keyword".




More information about the Python-list mailing list