Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Python sets.

Reply
Thread Tools

Python sets.

 
 
Grzegorz Dostatni
Guest
Posts: n/a
 
      05-04-2004

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)


 
Reply With Quote
 
 
 
 
Diez B. Roggisch
Guest
Posts: n/a
 
      05-04-2004
Grzegorz Dostatni wrote:
> 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.
--
Regards,

Diez B. Roggisch
 
Reply With Quote
 
 
 
 
George Yoshida
Guest
Posts: n/a
 
      05-04-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
 
Reply With Quote
 
Shalabh Chaturvedi
Guest
Posts: n/a
 
      05-05-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.


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


 
Reply With Quote
 
Dave Reed
Guest
Posts: n/a
 
      05-05-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])
>>>





 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: [Python-Dev] [python-committers] [RELEASED] Python 3.2 rc 1 R. David Murray Python 0 01-17-2011 02:23 PM
Re: [Python-Dev] [python-committers] [RELEASED] Python 3.2 rc 1 Senthil Kumaran Python 0 01-17-2011 10:31 AM
Re: [Python-Dev] [Python-3000] RELEASED Python 2.6a1 and 3.0a3 Martin v. Löwis Python 0 03-01-2008 10:51 PM
Re: [Python-Dev] [Python-3000] RELEASED Python 2.6a1 and 3.0a3 Paul Moore Python 0 03-01-2008 10:39 PM
Searching comp.lang.python/python-list@python.org (was: UTF-8) skip@pobox.com Python 0 03-10-2007 02:50 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57