Please Critique

Fredrik Lundh fredrik at pythonware.com
Tue Dec 14 04:21:46 EST 1999


Klaus Baldermann <kbaldermann at entire-systems.com> wrote:
> This could be even more perlified:
> 
>     while len(line) >= 4:
>         mydict.update({line[1:4]: line[0]})

ouch.  that's a really inefficient way
to modify a dictionary...

    mydict[line[1:4]] = line[0]

is not only easier to decipher, but also
about 10 times faster than your version...

</F>





More information about the Python-list mailing list