[Python-3000] Immutable lists (was: Re: Type annotations: annotating generators)

Collin Winter collinw at gmail.com
Mon May 22 17:56:45 CEST 2006

On 5/21/06, Guido van Rossum <guido at python.org> wrote:
> Since **kwds is already a dict (i.e. a mutable container) and since we
> long accept a list for *vargs on the call side, I think it is actually
> more logical to use a list for receiving *args.

I've started working on patches against the p3yk branch (side note:
could someone please do an 'svn mv p3yk py3k' to fix that name?) to
implement this change.

One thing I've run into several times in this process is the use of
*args as a dict key. As several others have mentioned, the "tuple ==
fixed-length, list == arbitrary-length" distinction means we now need
a way to create hashable lists. I propose a new, hashable frozenlist
built-in type to fill this niche.

This type would subclass from list, overriding __getitem__,
__delitem__, __hash__ and other methods as appropriate.

Thoughts? Does this need to go through a full PEP process?

Collin Winter

More information about the Python-3000 mailing list