Python sets.
Dave Reed
drlinux at columbus.rr.com
Tue May 4 22:07:03 EDT 2004
On Tuesday 04 May 2004 21:04, Shalabh Chaturvedi wrote:
> 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.
>
> You might have read "What's New in Python 2.4" which, as of now,
really
> explains what is *going* to be new in Python 2.4.
>
> --
> Shalabh
There's also a Set type in Python 2.3 although it may be changing in
2.4.
> python
Python 2.3 (#1, Jul 30 2003, 11:37:39)
[GCC 3.2.3] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import sets
>>> dir(sets)
['BaseSet', 'ImmutableSet', 'Set', '_TemporarilyImmutableSet',
'__all__', '__builtins__', '__doc__', '__file__', '__name__',
'ifilter', 'ifilterfalse']
>>> s = sets.Set([1, 2, 3])
>>> s
Set([1, 2, 3])
>>>
More information about the Python-list
mailing list