How to use list as key of dictionary?

Duncan Booth duncan.booth at invalid.invalid
Tue Nov 6 04:58:06 EST 2007


Wildemar Wildenburger <lasses_weil at klapptsowieso.net> wrote:

> maybe something like this could help:
> 
> def tupleize(non_tuple):
>      try:
>          return tuple(tupleize(thing) for thing in non_tuple)
>      except TypeError:
>          # non_tuple is not iterable
>          return non_tuple
> 

Just don't try passing that a string or anything containing a string.




More information about the Python-list mailing list