17 Feb
2009
17 Feb
'09
11:17 p.m.
On Tue, Feb 17, 2009 at 3:01 PM, Steven D'Aprano
I think that test_and_add is naturally two operations, not one, and forcing it to be one operation will just lead to confusion.
There is one scenario where testing membership and adding a new member *is* a single operation: multiple threads. That's a good reason to *not* support a test/change operation in regular sets as it may lead people to think (falsely) that it provide some kind of concurrency protection. --- Bruce