PEP 218 Re: ANN: set-0.1 module available
Erik Max Francis
max at alcyone.com
Fri May 17 15:48:27 EDT 2002
"Denis S. Otkidach" wrote:
> There are still unresolved issues. E.g. should set object be
> hashable? Somebody wish sets of sets or set as dict key that
> require set to be hashable.
I would say yes, a set should require an immutable object, for the same
reason that a dictionary key should. You couldn't have dictionaries
themselves as dictionary keys, and nobody seems to have a problem with
that.
I'm presuming that what's being considered is something close to the
mathematical definition of a set, where a set contains some number of
unique objects, in no defined order. Adding an object to a set which
already contains it does nothing, since it can only be in the set at
most once.
A set can't contain an infinite number of objects -- although you could
create a proxy object that has the interface of a set and behaves like
it does.
I'm envisioning an implementation which behaves much like a dictionary,
with the elements of the set as keys, and with dummy values. What's
wrong with that?
--
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/ \ Who'd ever think it / Such a squalid little ending
\__/ The American and Florence, _Chess_
Church / http://www.alcyone.com/pyos/church/
A lambda calculus explorer in Python.
More information about the Python-list
mailing list