> It's worth noting that "in" is defined by the container. Object > identity and equality aren't actually part of the definition. A lot of > containers will behave as the OP describes, but strings, notably, do > not - if you iterate over "caterpillar", you will never see "cat", yet > it is most definitely contained. I've been thinking of the `is in` operator using `in` when the iterable is just a single mass of items, like a string is just a single mass of characters. Is this a good idea? _______________________________________________ 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/NQQ7OWC5FCN2Z7KQL7M6SDXXS3OKFTSJ/ Code of Conduct: http://python.org/psf/codeofconduct/
- [Python-ideas] `is in`/`not is in` operators Jeremiah Vivian
- [Python-ideas] Re: `is in`/`not is in` operators Chris Angelico
- [Python-ideas] Re: `is in`/`not is in` operato... Jeremiah Vivian
- [Python-ideas] Re: `is in`/`not is in` ope... Chris Angelico
- [Python-ideas] Re: `is in`/`not is in`... Jeremiah Vivian
- [Python-ideas] Re: `is in`/`not is in` operators Steven D'Aprano
- [Python-ideas] Re: `is in`/`not is in` operato... Jeremiah Vivian
- [Python-ideas] Re: `is in`/`not is in` ope... Jeremiah Vivian
- [Python-ideas] Re: `is in`/`not is in` operato... Chris Angelico
- [Python-ideas] Re: `is in`/`not is in` ope... Jeremiah Vivian
- [Python-ideas] Re: `is in`/`not is in`... Chris Angelico
- [Python-ideas] Re: `is in`/`not i... Jeremiah Vivian
- [Python-ideas] Re: `is in`/`n... Chris Angelico
- [Python-ideas] Re: `is in... Steven D'Aprano
- [Python-ideas] Re: `is in... Jeremiah Vivian
- [Python-ideas] Re: `is in... Chris Angelico
- [Python-ideas] Re: `is in... Jeremiah Vivian
- [Python-ideas] Re: `is in... Chris Angelico
- [Python-ideas] Re: `is in... Christopher Barker
- [Python-ideas] Re: `is in... Jeremiah Vivian