[Python-ideas] set.add could return True or False

Matt Joiner anacrolix at gmail.com
Fri Mar 16 13:45:48 CET 2012

This, and more so removing duplication, are my reasons for suggesting it. A
lot of my code uses assertions to verify assumptions about uniqueness of
elements. This requires checking that an element isn't already present
before adding it.

Doing these checks on sets shared by threads requires locking, which is a
high cost when most operations allow "cheating" with the GIL. But this is a
minor boon.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120316/84bba477/attachment.html>

More information about the Python-ideas mailing list