not in

Alex Martelli aleax at aleax.it
Mon Jan 21 11:46:01 EST 2002


"rihad" <rihad at mail.ru> wrote in message
news:aibo4u48sa16v8fvrjsrrip9coc47n2108 at 4ax.com...
    ...
> >the semantics of "not a and not b" had better be basically the same
> >as those of "not (a or b)".  So what?  Would you can "not a and not b"
> >``new syntax''?  I suspect I'm missing your point -- what IS it?
> >
> Sorry (language barrier?). By `new' I meant that `not in' is a
> language construct, just as if it were a distinct not_in/is_not
> keyword. IOW, `new' eq `not necessary'. :)

Ah, just like, say, unary-plus (strictly non-necessary), binary
minus (non-necessary given the presence of unary-minus and binary
plus), and the backquote operator `...` (non-necessary given the
existence of builtin function repr).  Yes, operators 'not in' and
'is not' are indeed not part of a provably minimal subset of
necessary operators, just like many others.  Python does not
even attempt to provide a provably minimal subset; there is a
carefully-balanced amount of redundancy for increased readability.

For example, most readers will find:
    a - b
more readable than
    a + -b
even though they're obviously equivalent, semantically.


Alex






More information about the Python-list mailing list