14.10.19 03:47, Chris Angelico пише:
Though a set.__setitem__() method might be helpful here. If you set an
item to any truthy value, it is added to the set; set it to a falsy
value and it will be discarded (without error if it wasn't there, so
assignment in this way is idempotent). That would make them more
similar to collections.Counter, which can be seen as a multiset of
sorts.

It would be a fundamental difference from dict and Counter.

c = Counter()
c[1] = 0
assert 1 in c
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/KMKGNS5WOP4BQUPY4CNW66T7R7N4V2T2/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to