Multiple times I wished that sets had an `intersects` method. Simply the negation of the `set.isdisjoint` method. Sometimes I can write `not a.isdisjoint(b)`, but:
1) Together with the "dis", that's a double negation. Saying "a.intersects(b)" is the correct and much clearer way to express my intent. 2) I sometimes want to pass a set's bound method, for example as the first argument to `filter`, and then I can't pass that `not` along with it. The isdisjoint method is great. Takes any iterable, returns a bool, and is efficient: It doesn't turn the iterable into a set like some other `set` methods, but just iterates it and checks each element against the set (and stops early if it finds a common value). I'd like the same for `set.intersects`. _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/AVRZEYTDQS7EWBR22TV673NIRKODGOTW/ Code of Conduct: http://python.org/psf/codeofconduct/