PEP 218 Re: ANN: set-0.1 module available

James J. Besemer jb at cascade-sys.com
Fri May 17 08:16:21 EDT 2002


"Denis S. Otkidach" wrote:

> On Fri, 17 May 2002, James J. Besemer wrote:
>
> JJB> > That's to complex.  Maybe sets should be always immutable
> JJB> like
> JJB> > tuples?
> JJB>
> JJB> Python has clear precedent for doing so, in that strings,
> JJB> tuples
> JJB> and long integers all are immutable.
>
> Following these traditions we should have 2 types for sets: one
> immutable but hashable (like tuple) and one mutable (like list).

That would suit me just fine, though most would feel compelled to
pick just one or the other.

Right now, IIRC, lists and tuples are the ONLY pair of types that
seem to come in a mutable and unmutable pair.  Seems there's a good
reason for this in their case.

All the other basic types (numbers, strings, longs) are immutable
and all the other aggregate types (dicts, files, modules, etc.) are
mutable.

You could further argue that we must have a immutable form of SETs,
so they could serve as dictionary indices.  What's the argument for
having a mutable form, other than tuple has it?  Let alone both?

Regards

--jb


--
James J. Besemer  503-280-0838 voice
http://cascade-sys.com  503-280-0375 fax
mailto:jb at cascade-sys.com







More information about the Python-list mailing list