[Python-Dev] PEP 218 update questions
Guido van Rossum
guido@python.org
Sun, 13 Oct 2002 19:52:05 -0400
> I've just updated PEP 218 to match the sets.py module that's in CVS.
Thanks!
> The original PEP text had a single Set class, and Set instances froze
> after their __hash__ was called so you could use a set as a dictionary
> key. sets.py takes a more straightforward approach, with distinct Set
> and ImmutableSet classes.
>
> Two things in the PEP need to be updated to take this change into account.
>
> 1)
> The long-term proposal in PEP 218 lists a single built-in conversion
> function, set(iterable). This made sense when there was a single Set
> class, but now this needs to be updated.
>
> How would instances of a built-in immutable set type be created?
> Would there be a second immutable_set() built-in, or would the set()
> function take an additional argument: set(iterable, immutable=True)?
>
> 2)
> The PEP proposes {1,2,3} as the set notation and {-} for the empty
> set. Would there be different syntax for an immutable and a mutable
> set?
>
> My thought is, "no"; {1,2,3} or {-} is always mutable, and an
> immutable set would be written as immutable_set({1,2,3}). That's up
> to python-dev, though, but whatever gets chosen needs to be specified
> in the PEP.
I don't want to think about this right now -- and it's not yet
relevant since I expect this won't become an built-in type for a
couple more releases. Can't you just add these questions to the PEP
as unresolved issues?
--Guido van Rossum (home page: http://www.python.org/~guido/)