On Mon, Aug 10, 2020 at 12:20:49PM +0100, haael wrote:
Forgive me if this has already been discussed.
Could we add the idea of "negative" sets to Python? That means sets that contain EVERYTHING EXCEPT certain elements.
Can you give an example of what you would use this for? A use-case.
It seems to me that the easiest way to use this would be to use invert the meaning of your universal set. Instead of:
unprocessed = set.UNIVERSAL for element in universe(): if element in unprocessed: process(element) unprocessed.remove(element)
do it like this:
processed = set() for element in universe(): if element not in processed: process(element) processed.add(element)
If you have a different use-case to this, I don't know what it would be.