The Python Oracle

Is it possible for `__contains__` to return non-boolean value?

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Track title: CC H Dvoks String Quartet No 12 Ame

--

Chapters
00:00 Question
00:44 Accepted answer (Score 5)
01:47 Answer 2 (Score 9)
02:10 Answer 3 (Score 6)
02:34 Answer 4 (Score 5)
03:27 Thank you

--

Full question
https://stackoverflow.com/questions/5335...

Accepted answer links:
[Can the Python bool() function raise an exception for an invalid argument?]: https://stackoverflow.com/questions/5286...

Answer 3 links:
[coerces]: https://github.com/python/cpython/blob/6...
[always]: https://github.com/python/cpython/blob/6...

Answer 4 links:
[6.10.2. Membership test operations]: https://docs.python.org/3.7/reference/ex...
[__contains__()]: https://docs.python.org/3.7/reference/da...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python

#avk47