Python sets.

George Yoshida ml at dynkin.com
Tue May 4 17:49:05 EDT 2004


Grzegorz Dostatni wrote:
> I've got a problem.
> 
> Some time ago (I'm a bit fuzzy about the date) I read about sets in
> python. I even tried the code. I remember it was something fairly simple -
> just a base data type (like list or dictionary).  I vaguely remember it
> had a syntax similar to creating dictionaries.
> 
> Problem is I can't find it anymore. I've searched around, but it doesn't
> seem to exist. I know of "import sets" and creating classes like that, but
> I'm sure it was a base data type. No import necessary.  There were
> operators for basic set operations like set difference, division, etc.
> 
I guess you're talking about built-in set type.
But be warned that it will be introduced in Python 2.4, so if you want 
to try it right now, you need to compile it with yourself from the CVS 
source tree.

Following links might help:
* PEP : Adding a Built-In Set Object Type
   http://www.python.org/peps/pep-0218.html
* What's New in Python 2.4 : Built-In Set Objects
   http://www.python.org/dev/doc/devel/whatsnew/node2.html

-- George



More information about the Python-list mailing list