
On Wed, Jan 1, 2020 at 12:50 AM <iman.h.a.khamse@gmail.com> wrote:
Hi I think the following syntax's:
if foo in foobar or bar in foobar or baz in foobar: pass if foo in foobar and bar in foobar and baz in foobar: pass
can be more readable and shorter if written as:
if foo or bar or baz in foobar: pass if foo and bar and baz in foobar: pass
maybe for "is" instead of:
if foobar is foo or foobar is bar or foobar is baz: pass
if foobar is foo or bar or baz: pass
now the recommended syntax translate to this: (I think so)
if foo (IS NOT '0' or None or empty) or bar (IS NOT '0' or None or empty) or baz in foobar
so probably we must introduce a new type of 'or' (I recommend the CAPITAL "OR","AND") so this:
if foo OR bar OR baz in foobar: pass
translates to this:
if foo in foobar or bar in foobar or baz in foobar: pass
If you're testing if any of several things is in a collection, you probably should consider set intersection instead :) if {foo, bar, baz} & foobar: pass ChrisA