I completely agree. All the variations suggested are unreadable mish-mash.
Set intersection exists already and it's completely clear.

On Tue, Dec 31, 2019, 12:05 PM Jonathan Crall <erote...@gmail.com> wrote:

> For what its worth, I find the proposed syntax confusing and difficult to
> read. Conceptually it makes sense, but using existing set operations seems
> like a far more readable way to handle this case.
>
> On Tue, Dec 31, 2019 at 11:03 AM Richard Damon <rich...@damon-family.org>
> wrote:
>
>> On 12/31/19 1:20 AM, iman.h.a.kha...@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 I were to change the syntax ( which I don't propose), I believe the
>> construct like foo or bar or baz in foobar to give you issues parsing.
>> An alternative which is, in my opinion, more readable would be if
>> any(foo, bar, baz) in foobar (and the alternative if all(foo, bar, baz)
>> in foobar). To do this any and all could make a specially tagged tupl
>> which interacts with operators like 'in' in a special way where it
>> applies each of its members and or/ands the results.
>>
>> It may even be possible to do this with the existing Python by defining
>> a suitable class any and all with an appropriate constructor and
>> implementing its own version of things like in. (not sure if we can
>> override 'is')
>>
>> --
>> Richard Damon
>> _______________________________________________
>> Python-ideas mailing list -- python-ideas@python.org
>> To unsubscribe send an email to python-ideas-le...@python.org
>> https://mail.python.org/mailman3/lists/python-ideas.python.org/
>> Message archived at
>> https://mail.python.org/archives/list/python-ideas@python.org/message/VGN4PW5LV7LMDA3ORP33BYBHJDEFMEGU/
>> Code of Conduct: http://python.org/psf/codeofconduct/
>>
>
>
> --
> -Jon
> _______________________________________________
> Python-ideas mailing list -- python-ideas@python.org
> To unsubscribe send an email to python-ideas-le...@python.org
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at
> https://mail.python.org/archives/list/python-ideas@python.org/message/OTKTGKG4Y7ZTZ4VCUY3VCQCJGFNFVNJP/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/FHVAQ2AHSEO7FIMSZUCCQ4XXUCXJFQP4/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to