what is the the best way to express following:

James Stroud jstroud at ucla.edu
Mon Mar 27 22:10:03 EST 2006


AndyL wrote:
> James Stroud wrote:
> 
>> Here is a suggestion
>>
>> todo = {(int, long):abc, (str,):afg, (tuple, list):ijk}
>> todo[type(key)]()
> 
> 
> 
> Is not that a shortcut? I have got "KeyError" exception ...

No, I hit send too soon, mixing ideas in my head. Paul McGuire's answer 
is the way to go.

James

-- 
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/



More information about the Python-list mailing list