[Python-Dev] I think my set module is ready for prime time; comments?

M.-A. Lemburg mal@lemburg.com
Tue, 23 Jan 2001 11:26:16 +0100


"Eric S. Raymond" wrote:
> 
> Guido van Rossum <guido@digicool.com>:
> > There's already a PEP on a set object type, and everybody and their
> > aunt has already implemented a set datatype.
> 
> I've just read the PEP.  Greg's proposal has a couple of problems.
> The biggest one is that the interface design isn't very Pythonic --
> it's formally adequate, but doesn't exploit the extent to which sets
> naturally have common semantics with existing Python sequence types.
> This is bad; it means that a lot of code that could otherwise ignore
> the difference between lists and sets would have to be specialized
> one way or the other for no good reason.
> 
> The only other set module I can find in the Vaults or anywhere else is
> kjBuckets (which I knew about before).  Looks like a good design, but
> complicated -- and requires installation of an extension.

There's also a kjSet.py available at Aaron's site:

	http://www.chordate.com/kwParsing/index.html

which is a pure Python version of the C extenion's kjSet type.
 
> > If *your* set module is ready for prime time, why not publish it in
> > the Vaults of Parnassus?
> 
> I suppose that's what I'll do if you don't bless it for the standard
> library.  But here are the reasons I suggest you should do so:
> 
> 1. It supports a set of operations that are both often useful and
> fiddly to get right, thus enhancing the "batteries are included"
> effect.  (I used its ancestor for representing seen-message numbers in
> a specialized mailreader, for example.)
> 
> 2. It's simple for application programmers to use.  No extension module
> to integrate.
> 
> 3. It's unsurprising.  My set objects behave almost exactly like other
> mutable sequences, with all the same built-in methods working, except for
> the fact that you can't introduce duplicates with the mutators.
> 
> 4. It's already completely documented in a form suitable for the library.
> 
> 5. It's simple enough not to cause you maintainance hassles down the
> road, and even if it did the maintainer is unlikely to disappear :-).

All very well, but are sets really that essential to every
day Python programming ? If we include sets then we ought to
also include graphs, tries, btrees and all those other goodies
we have in computer science. All of these types are available
out there, but I believe the audience who really cares for these
types is also capable of downloading the extensions and installing
them.

It would be nice if all of these extension could go into a SUMO
edition of Python though... together with your set module.

-- 
Marc-Andre Lemburg
______________________________________________________________________
Company:                                        http://www.egenix.com/
Consulting:                                    http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/