[Python-Dev] syntactic support for sets

Donovan Baarda abo at minkirri.apana.org.au
Fri Feb 3 18:04:24 CET 2006

On Fri, 2006-02-03 at 09:00 -0800, Josiah Carlson wrote:
> Sets are tacked on.  That's why you need to use 'import sets' to get to
> them, in a similar fashion that you need to use 'import array' to get
> access to C-like arrays.

No you don't;

$ python
Python 2.4.1 (#2, Mar 30 2005, 21:51:10)
[GCC 3.3.5 (Debian 1:3.3.5-8ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> v=set((1,2,3))
>>> f=frozenset(v)

set and frozenset are now builtin.

> I personally object to making syntax for sets for the same reasons I
> object to making arrays, heapqs, Queues, deques, or any of the other
> data structure-defining modules in the standard library into syntax.

Nuff was a fairy... though I guess it depends on where you draw the
line; should [1,2,3] be list(1,2,3)?

Donovan Baarda <abo at minkirri.apana.org.au>

More information about the Python-Dev mailing list