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

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Thu Feb 19 10:01:39 CET 2009

> All in all, I am now siding with Raymond -- let's leave well enough
> alone. Hopefully we can now retire this thread, I don't think there's
> much more that can be said that hasn't been said already.

FWIW, a few thoughts anyway:

- I don't actually care about performance**. It was a mistake on my part to try to abuse
  the performance argument for what I was really after: elegance (defined as power/volume
  while still looking simple).

- I always assumed it must be an oversight that set.add() doesn't return a trivial
  piece of information that it has. Somebody has made the arbitrary decision to withhold
  this information from me, like you withhold certain information from a child. It feels
  very wrong. I'm grown up and wish to take responsibility myself. "If I don't like it,
  you cannot use it" is forceful; "If you don't like it, just don't use it" is a much
  better tone between partners.

- The purity argument was used a lot. In my opinion, set would be pure if it didn't arbitrarily
  withhold information from me that would allow me to make my algorithms more concise. Or as
  Einstein put it, "Make everything as simple as possible, but not simpler."
  set.add() returning None is failing the "but" part.

** 1. If performance really matters I will go to C++ anyway.
   2. These days, I can simply put "if (i % chunk_n != chunk_i): continue" into some loop
      and throw the calculation at a few hundred (chunk_n) CPUs.

More information about the Python-ideas mailing list