what is the the best way to express following:
Felipe Almeida Lessa
felipe.lessa at gmail.com
Mon Mar 27 22:45:26 EST 2006
Em Seg, 2006-03-27 às 18:43 -0800, James Stroud escreveu:
> Here is a suggestion
>
> todo = {(int, long):abc, (str,):afg, (tuple, list):ijk}
> todo[type(key)]()
Maybe...
todo = {(int, long): abc, basestr: afg, (tuple, list): ijk}
(y for x,y in todo.iteritems() if isinstance(key, x)).next()()
Forget it! Damn, that's too unpythonic! (or perlish =)
--
Felipe.
More information about the Python-list
mailing list