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

Bill Janssen janssen at parc.com
Tue Feb 17 19:02:20 CET 2009


Guido van Rossum <guido at python.org> wrote:

> This example also has a bug, which neither of the two posters
> responding caught (unless Bill J was being *very* subtle).

Sorry, I should have been more brutal.  To my mind, the fact that Steve
got it wrong was a nice illustration of how much extra mental effort
needed to be expended because the feature Ralf suggests wasn't
available.  You have to write a test, the test has to include an
inversion, you have to introduce a new variable to hold the result of
the test.  That's something like 3 function points, instead of one.

Functionality "built in" into the standard library is much better for
everyone than functionality a programmer has to generate himself, mainly
because of the extra review it gets.  I think that's the real payoff for
"batteries included".

Bill



More information about the Python-ideas mailing list