[Python-ideas] set.add() return value

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Feb 13 23:46:40 CET 2009

Chris Rebert wrote:

> As The Zen says: "Special cases aren't special enough to break the rules."

What might be more acceptable is to add a new method
for this, with a name suggesting that it's more than
just a plain mutating operation, e.g.

   was_it_there = myset.test_and_add(42)


More information about the Python-ideas mailing list