Help understanding the decisions *behind* python?
inky788 at gmail.com
Wed Jul 22 16:36:51 CEST 2009
On Jul 22, 2:36 am, Hendrik van Rooyen <hend... at microcorp.co.za>
> On Tuesday 21 July 2009 15:49:59 Inky 788 wrote:
> > On Jul 20, 12:27 pm, Phillip B Oldham <phillip.old... at gmail.com>
> > wrote:
> > > [snip] We
> > > understand that lists are mutable and tuples are not, but we're a
> > > little lost as to why the two were kept separate from the start. They
> > > both perform a very similar job as far as we can tell.
> > My guess is that it was probably for optimization reasons long ago.
> > I've never heard a *good* reason why Python needs both.
> The good reason is the immutability, which lets you use
> a tuple as a dict key.
Thanks for the reply Hendrik (and Steven (other reply)). Perhaps I'm
just not sophisticated enough, but I've never wanted to use a list/
tuple as a dict key. This sounds like obscure usage, and a bit
contrived as a reason for having *both* lists and tuples.
More information about the Python-list