Usefulness of the "not in" operator

candide candide at free.invalid
Sat Oct 8 10:40:58 EDT 2011


Le 08/10/2011 14:41, Alain Ketterlin a écrit :

> Operators like "not in" and "is not" should
> really be considered single tokens, even though they seem to use "not".
> And I think they are really convenient.

I realize that I was confused by the lexical form of the "not in" 
operator : it is made by juxtaposing two other operators. Operators 
composed from two other operators exist, for instance != but the two 
cannot be separated, for instance

2 !   =   3

is not a valid expression. Said in another way, in Python syntax, 
usually a "lexically juxtaposed operator"  is seen as a whole. This is 
not the case for an operator such as "is not" or "not in" because for 
example

 >>> 2              is                     not  3

is a valid statement.

A notin operator or isnot operator would be less confusing (at least in 
my case ;) ).



More information about the Python-list mailing list