not in

rihad rihad at mail.ru
Mon Jan 21 17:24:38 CET 2002


On Mon, 21 Jan 2002 07:49:01 -0800, "Mark McEahern"
<marklists at mceahern.com> wrote:

>rihad wrote:
>> Why does python introduce new syntax with `x not in s'? Isn't it the
>> same as `not (x in s)'? Same for `is not'.
>
>Wow, what a good point!  Yeah, and why do BOTH of these work?
>
>	if 2 + 3 == 5:
>		print "true!"
>
>	if 3 + 2 == 5:
>		print "true!"
>
>And I thought Python was simple.  That's just too much flexibility.
>
>Sheesh!

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
wrong: I'm not accusing anyone, I don't possess the 1f/1000 of
knowledge and experience of GvR and regulars here and my language
desing skills are zilch. I'm only asking why it is the way it is :)




More information about the Python-list mailing list