Python sets.

  • Thread starter Grzegorz Dostatni
  • Start date
G

Grzegorz Dostatni

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.

Please tell me I'm not loosing my mind. Please tell me that these kind of
things did/still exist?

Greg


Advice is what we ask for when we already know the answer but wish we
didn't.
-- Erica Jong (How to Save Your Own Life, 1977)
 
D

Diez B. Roggisch

Grzegorz said:
Please tell me I'm not loosing my mind. Please tell me that these kind of
things did/still exist?

while this is bad news for you - it looks like you lost your mind. AFAIK a
builtin-syntax for lists has been discussed, but I have no idea what the
outcome of that discussion has been.

And the sets-module supports the operators by overloading.
 
G

George Yoshida

Grzegorz said:
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
 
S

Shalabh Chaturvedi

Grzegorz said:
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.
 
D

Dave Reed

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.

There's also a Set type in Python 2.3 although it may be changing in
2.4.
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.['BaseSet', 'ImmutableSet', 'Set', '_TemporarilyImmutableSet',
'__all__', '__builtins__', '__doc__', '__file__', '__name__',
'ifilter', 'ifilterfalse']
s = sets.Set([1, 2, 3])
s Set([1, 2, 3])
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,244
Members
46,839
Latest member
MartinaBur

Latest Threads

Top