a dictionary from a list

George Sakkis gsakkis at rutgers.edu
Fri Jun 24 19:43:53 EDT 2005


"Rocco Moretti" wrote:

> Are you sure you need a dictionary? You may want to look at the Set
> module instead, if the values aren't important.

Set is the name of the type in the module sets, introduced in 2.3.
Since 2.4 you can use the builtin set type. Here's the import snippet
that works for 2.3 or later:

try: set
except NameError:
    from sets import Set as set

George




More information about the Python-list mailing list