Sets Module Bug?

Marek Baczyński imbaczek-nospam at poczta.fm.cut-from-here.no-spam.info
Mon Aug 2 08:33:18 EDT 2004


Dnia Mon, 02 Aug 2004 05:25:50 -0400, Chris S. napisał(a):

> How can a Set using a tuple or list be ok, but not a tuple of lists?

Because tuples can't be changed once they're constructed (= immutable.)
You'd get the same error if you tried to do

>>> d = {[1,2]: 'foo'}

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in -toplevel-
    d = {[1,2]: 'foo'}
TypeError: list objects are unhashable

-- 
Marek Baczyński :: UIN 57114871 :: GG 161671 :: JID imbaczek at jabber.gda.pl
He who knows best best knows how little he knows. -- Thomas Jefferson



More information about the Python-list mailing list