On Mon, Oct 25, 2021 at 7:40 PM Jeremiah Vivian
<nohackingofkrow...@gmail.com> wrote:
>
> I DO expect this thread to be bombarded with negative replies.
>
> Currently, there are `in`/`not in` operators which work like this in Python:
> > def contains(contains_value, iterable, not_in):
> >     for element in iterable:
> >         if element == contains_value:
> >             return True ^ not_in
> >     return False ^ not_in
> If I wanted to check if an *exact* object is in an iterable, I would have to 
> loop like this (reverse boolean values for implementation of `not is in`):
> > is_in = False
> > for element in iterable:
> >     if element is contains_value:
> >         is_in = True
> I would want a more *convenient* way to check for this value. So therefore, 
> there should be `is in`/`not is in` operators to do it better. Is this a 
> valid reason?

What's your use-case? Can you give an example? Sometimes the solution
is a different data structure, like an identidict.

ChrisA
_______________________________________________
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/ZMMBKMNYKRDXUSFCPKN6QUE27C3IQ2OG/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to