Oh my!  ;)

So, after the previous discussion about when __contains__ should raise TypeError instead of returning False, it seems there are a couple cases where a TypeError should be raised now:

1)  non-enum-instance in EnumClass
2)  anything in enum_instance
3)  non-flag-instance in flag instance

(1) can be True/False if an Enum instance is checked for;
(2) should (and does already) always raise TypeError;
(3) can be True/False when a Flag instance is checked for in another flag 
instance.

I suspect these are corner cases, and infrequently, if ever, being used incorrectly now, but I would rather have a deprecation period in 3.7 instead of just changing in 3.8 to TypeErrors. To that end I have a PR [1] readay, and would appreciate any review, thoughts, and/or comments.

--
~Ethan~

[1] https://github.com/python/cpython/pull/6392
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to