A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/096574.html below:

Why tuples ???

Why tuples ???Michael Hudson mwh21 at cam.ac.uk
Mon Apr 23 13:05:15 EDT 2001
"Fredrik Lundh" <fredrik at pythonware.com> writes:

> Thomas Weidner wrote:
> > I started lerning Python and discovered tuples, but why do they exist ?
> > What's the difference from a list ?
> 
> did you remember to check the FAQ?
> 
>     http://www.python.org/doc/FAQ.html#6.15
>     Q. Why are there separate tuple and list data types?
> 
> also consider this code fragment:
> 
> >>> T = (1, 2, 3)
> >>> L = (1, 2, 3)

How did you manage that typo?  I can't believe you cooked up the whole
session - unless you can type tracebacks from memory, which would be
scary...

> >>> D = {}
> >>> D[T] = "spam"
> >>> D[L] = "spam"
> Traceback (innermost last):
>   File "<stdin>", line 1, in ?
> TypeError: unhashable type
> 
[snip]

Cheers,
M.

-- 
 Very clever implementation techniques are required to implement this
 insanity correctly and usefully, not to mention that code written
 with this feature used and abused east and west is exceptionally
 exciting to debug.       -- Erik Naggum on Algol-style "call-by-name"

More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4