what is the the best way to express following:

Felipe Almeida Lessa felipe.lessa at gmail.com
Tue Mar 28 05:45:26 CEST 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)]()


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 =)


More information about the Python-list mailing list