How to use list as key of dictionary?
Wildemar Wildenburger
lasses_weil at klapptsowieso.net
Wed Nov 7 13:14:16 EST 2007
Duncan Booth wrote:
> Better, just don't try passing it a recursive data structure.
>
>>>> a = [1, 2, 3]
>>>> a[1] = a
>>>> a
> [1, [...], 3]
>>>> tupleize(a)
>
>
> Traceback (most recent call last):
> File "<pyshell#5>", line 1, in <module>
> tupleize(a)
> File "<pyshell#1>", line 5, in tupleize
> return tuple(tupleize(thing) for thing in non_tuple)
> File "<pyshell#1>", line 5, in <genexpr>
> return tuple(tupleize(thing) for thing in non_tuple)
> File "<pyshell#1>", line 5, in tupleize
> return tuple(tupleize(thing) for thing in non_tuple)
> File "<pyshell#1>", line 5, in <genexpr>
> return tuple(tupleize(thing) for thing in non_tuple)
> File "<pyshell#1>", line 5, in tupleize
> return tuple(tupleize(thing) for thing in non_tuple)
> ...
Your'e a fiend!
;)
/W
More information about the Python-list
mailing list