28 Oct
2021
28 Oct
'21
9:17 p.m.
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