PEP 218 Re: ANN: set-0.1 module available

James J. Besemer jb at cascade-sys.com
Fri May 17 22:37:50 EDT 2002


Erik Max Francis wrote:

> I see.  Certainly it's not inconceivable that some might use sets in
> this manner, but it seems just as likely, if not more so, that people
> would want sets (themselves) to be mutable, so that objects can be added
> and removed.

But fundamentally, this is like saying long integers must be mutable because
people will want to set and clear individual bits.  Or that strings must be
mutable because people will want to append and truncate.  Sure it's
necessary to compute new set values but they don't require that the
underlying type be mutable.

I wonder if you are perhaps too deeply attached to a particular
implementation?

> Certainly having the sets themselves, like tuples, being immutable
> eliminates the question of what kind of elements can be contained within
> them, but that seems extremely limiting.  The goal here is finding the
> right balance between usefulness and arbitrary limitations.

I hadn't considered the implication of mutable objects as set members.   If
you allow an arbitrary list/tree structure to be members, how do you decide
if it's in the set or not?  You only consider the list object itself or do
you look at its overall value?

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