On 21Nov2018 19:40, MRAB <pyt...@mrabarnett.plus.com> wrote:
On 2018-11-21 19:18, Python wrote:
1 in [1,2,3] == True
False

It's a chained comparison. It applies to '<', '<=', '>', '>=', '==' and '!=', but also to 'in', although I've never seen a chained comparison using 'in' in practice.

Me either. In fact, I was as stumped as the OP. I've never really considered "in" as a comparison; in my mind comparisons are between like items: numbers vs numbers, and so forth. Not elements versus a collection of elements.

Can someone show me a real world, or failing that - sane looking, chained comparison using "in"?

Cheers,
Cameron Simpson <c...@cskk.id.au>
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to