Please Critique

Klaus Baldermann kbaldermann at entire-systems.com
Tue Dec 14 03:00:14 EST 1999


John Farrell wrote in message <3855DB3D.998F3081 at mincom.com>...

>>     while start < length:
>>         end = start + 4
>>         startkey = start + 1
>>         mydict[trimline[startkey:end]] = trimline[start:end]
>>         start = end


>    while len(line) >= 4:
>        instruction = line[0]
>        number = line[1:4]
>        line = line[4:]
>        mydict[number] = instruction


This could be even more perlified:

    while len(line) >= 4:
        mydict.update({line[1:4]: line[0]})
        line = line[4:]

Klaus






More information about the Python-list mailing list