When is an empty container contained by a non-empty container?

For example:

{} in {1:'a', 'b':2]   <-- TypeError because of hashability

set() in {1, 2, 'a', 'b'}  <-- ditto

[] in ['a', 'b', 1, 2]  <-- False

'' in 'a1b2'  <-- True

SomeFlag.nothing in SomeFlag.something  <--  ???


Personally, I have never had a use for '' in 'some string' being True, and always have to guard against that scenario. Likewise, if an empty collection of flags is contained by a collection of flags, then that will trip me up as well; on the other hand, it seems that collections of related flags are often treated as in set theory, where the empty set is a member of any non-empty set...

So, does Flag adhere to set theory, or is just happenstance that some operators 
work the same for both groups?

Can we have `SomeFlag.nothing in SomeFlag.something` be `False`, or would that 
be too surprising?

--
~Ethan~
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/DAQV4BQDX6NLPF4PLEZ233FPANNKKIVW/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to