Iterating over a dictionary's sorted keys

Philip 'Yes, that's my address' Newton nospam.newton at gmx.li
Sat May 27 07:53:55 CEST 2000


On Fri, 26 May 2000 17:38:02 GMT, rjroy at takingcontrol.com (Robert Roy)
wrote:

> On Thu, 25 May 2000 19:44:29 GMT, nospam.newton at gmx.li (Philip 'Yes,
> that's my address' Newton) wrote:
> 
> >But not named temporary stuff that sticks around.
> 
> Then get rid of the named stuff afterwards.
> 
>     # now that you're done  with keys
>     # you can get rid of the list
>     keys = None

That didn't get rid of keys. I think you meant to say "del keys". But
it's still more typing -- I think I shouldn't have to bother explicitly
naming (and clearing up after!) my temporary variables any more than I
should have to translate

   a = 1 + 2 * 3

to

   temp1 = 2 * 3
   temp2 = 1 + temp1
   a = temp2
   del temp2
   del temp1

-- the compiler should do that for me.

Cheers,
Philip
-- 
Philip Newton <nospam.newton at gmx.li>
If you're not part of the solution, you're part of the precipitate.



More information about the Python-list mailing list