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

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Feb 17 22:18:19 CET 2009

Terry Reedy wrote:

 > Greg Ewing wrote [concerning NFA to DFA]:
> But why not just unconditionally add them?

Because you also need to know whether it was already
in the set, so you can terminate the recursion.

> Marcin just posted a nice solution for proceeding differently if really 
> necessary.

Yes, that's a neat trick! It does obfuscate the
code a little bit, though.


More information about the Python-ideas mailing list