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

uche.ogbuji@fourthought.com uche.ogbuji@fourthought.com
Tue, 23 Jan 2001 11:16:27 -0700


> 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.

Tim mentioned that he had one, and he also claimed that every other dodder had 
a set class, but the only one listed in the vaults is kjBuckets, which I'm not 
sure is maintained any more.  (Is Aaron Watters hereabouts?)

> 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.

IMO, Eric's Set interface is close to perfect.

PEP 218 is interesting, but I'm not sure it's worth slogging through the 
inevitable uproar over an entirely new syntactic construct (the "{}" notation) 
before getting something as useful as a set class into the standard library.


> > 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:

For what it's worth, I'm +1 on adding this to the standard library.  I've seen 
so many set hacks with dictionaries (memory ouch) and list hacks (speed ouch) 
in Python code out there, that I'm convinced it would meet much more common 
usage than, say zlib, xdr, or even expat.

On this hacker list everyone's aunt might whip up set extensions on boring 
weekends, but I doubt this describes the overall Python populace.


-- 
Uche Ogbuji                               Principal Consultant
uche.ogbuji@fourthought.com               +1 303 583 9900 x 101
Fourthought, Inc.                         http://Fourthought.com 
4735 East Walnut St, Ste. C, Boulder, CO 80301-2537, USA
Software-engineering, knowledge-management, XML, CORBA, Linux, Python