On Thu, Oct 28, 2021 at 3:04 AM Steven D'Aprano 
The "in" operator is built on iteration, but can be overridden by the
`__contains__` method.

I would say it is built on __contains__, but will fall back on iteration :-)

Effectively the same, but conceptually a bit different.

There is also the expectation that the two methods provide the same results, as with dicts.

-CHB


--
Christopher Barker, PhD (Chris)

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython