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

Josiah Carlson jcarlson at uci.edu
Mon May 22 21:13:51 CEST 2006

"Guido van Rossum" <guido at python.org> wrote:
> On 5/22/06, Collin Winter <collinw at gmail.com> wrote:
> > 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?
> No, no, no!

Or to clarify Guido: use a tuple.  Tuples are also arbitrary-length, and
serve the same purposes that any 'frozen list' equivalent would.

 - Josiah

More information about the Python-3000 mailing list