Odd truth result with in and ==

Chris Angelico rosuav at gmail.com
Wed Nov 21 19:09:04 EST 2018


On Thu, Nov 22, 2018 at 11:04 AM Dan Sommers
<2QdxY4RzWzUUiLuE at potatochowder.com> wrote:
> But the second one has to do an expensive subset operation.  If I think
> "is elem in both sets," then I'd never write:
>
>      (elem in set1) and (set1 <= set2)

Yes, but that doesn't mean "is elem in both sets". It means "is elem
in set 1, which needs to be a subset of set 2". I'm not sure where
that would come up though.

ChrisA



More information about the Python-list mailing list