[Python-Dev] PEP 218 update questions

Brett Cannon drifty@bigfoot.com
Sun, 13 Oct 2002 14:43:27 -0700 (PDT)


[A.M. Kuchling]

> 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)?
>

I say have a single set() with an argument flag.  Mutable or not, they are
both subsets of BaseSet and thus should be reflected in the constructor
function.

> 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?
>

As long as mutable sets can be automatically converted to immutable, I say
keep only one syntax.  If the user wants to explicitly create an immutable
set, call set(mutable_set, immutable=True) or have a very explicit way for
mutable sets to turn themselves into immutable sets.  No need to add more
syntax for something that can automatically be done for the user.

-Brett C.