# [Python-Dev] Re: PEP 218 (sets); moving set.py to Lib

**Eric S. Raymond
**
esr@thyrsus.com

*Wed, 21 Aug 2002 00:12:52 -0400*

Guido van Rossum <guido@python.org>:
>* > Are you slapping your forehead yet? :-)
*>*
*>* Yes! I didn't actually know that algorithm.
*
I thought it up myself. Which is funny, since to get there you have to
think like a hardware engineer rather than a logician. My brain was
definitely out of character that day.
>* This is a generator that yields a series of lists whose values are the
*>* items of base. And again, like cartesian product, it's now more a
*>* generator thing than a set thing.
*
I don't care where it lives, really. I just like the concision of
being able to say foo.powerset(). Not that I've used this yet, but I
know one algorithm for which it would be helpful. Another one I
invented, actually, back when I really was a mathematician -- a closed
form for sums of certain categories of probability distributions. I
called it the Dungeon Dice Theorem. Never published it.
>* BTW, the correctness of all my versions trivially derives from the
*>* correctness of your version -- each is a very simple transformation of
*>* the previous one. My mentor Lambert Meertens calls this process
*>* Algorithmics (and has developed a mathematical notation and theory for
*>* program transformations).
*
Web pointer?
--
<a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a>