Sorting a Dictionary

Remco Gerlich scarblac-spamtrap at pino.selwerd.nl
Tue Mar 14 10:47:53 EST 2000


rbl at hal.cwru.edu wrote in comp.lang.python:
> then added the following to get one count, word1, word2 tuple on each line:
> 
> for i in range(len(l)):
> 		print l[i]

But but but... why not simply

for i in l:
   print i

That idiom range(len(l)) is only useful if you're actually doing something
with the index, other than using it as an index...

Just a minor nitpick, of course :)
-- 
Remco Gerlich,  scarblac at pino.selwerd.nl

   This is no way to be
     Man ought to be free      -- Ted Bundy
       That man should be me



More information about the Python-list mailing list