Dictionary from list?

Chris Barker chrishbarker at home.net
Mon Oct 22 13:24:14 EDT 2001


Tim Peters wrote:

> So what should dictionary(x) do?

Personally, I would find:

dict = dictionary(sequence_of_keys, sequence_of_values)

most valuable to me because I have found the need for it enought times
that I have written my own function to do it, and have used it a lot.

If it were:

dict = dictionary(sequence_of_keys_value_pairs)

I could do:

dict = dictionary(zip(sequence_of_keys, sequence_of_values))

So that would be me second choice.

All I can say about:

dictionary([k,v,k,v,k,v]) is 

YECH! (IMHO, of course)

-Chris





-- 
Christopher Barker,
Ph.D.                                                           
ChrisHBarker at home.net                 ---           ---           ---
http://members.home.net/barkerlohmann ---@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Oil Spill Modeling                ------   @    ------   @   ------   @
Water Resources Engineering       -------      ---------     --------    
Coastal and Fluvial Hydrodynamics --------------------------------------
------------------------------------------------------------------------



More information about the Python-list mailing list