Re: [Tutor] Iterating over sorted dictionary keys in one line

2005-09-18 Thread bob
At 10:30 AM 9/18/2005, Kent Johnson wrote: >Marcin Komorowski wrote: > > I know that one of the ways to iterate over sorted dictionary keys is: > > keylist = dictionary.keys() > > keylist.sort() > > for key in keylist: > > ... > > > > Is there a way to do this in a single line.

Re: [Tutor] Iterating over sorted dictionary keys in one line

2005-09-18 Thread John Fouhy
On 19/09/05, Marcin Komorowski <[EMAIL PROTECTED]> wrote: > Is there a way to do this in a single line. Something like this would be > ideal: > for key in dictionary.keys().soft(): Hi Marcin, Others have already answered you, but just to follow up: There is a reason why lst.sort() returns

Re: [Tutor] Iterating over sorted dictionary keys in one line

2005-09-18 Thread Kent Johnson
Marcin Komorowski wrote: > I know that one of the ways to iterate over sorted dictionary keys is: > keylist = dictionary.keys() > keylist.sort() > for key in keylist: > ... > > Is there a way to do this in a single line. Something like this would > be ideal: > for key in

Re: [Tutor] Iterating over sorted dictionary keys in one line

2005-09-18 Thread Pawel Kraszewski
Dnia niedziela, 18 września 2005 19:20, Marcin Komorowski napisał: > I know that one of the ways to iterate over sorted dictionary keys is: > keylist = dictionary.keys() > keylist.sort() > for key in keylist: > ... Indeed, 'sort' sorts its argument in-place and returns 'none'.

[Tutor] Iterating over sorted dictionary keys in one line

2005-09-18 Thread Marcin Komorowski
I know that one of the ways to iterate over sorted dictionary keys is:     keylist = dictionary.keys()     keylist.sort()     for key in keylist:         ...   Is there a way to do this in a single line.  Something like this would be ideal:     for key in dictionary.keys().soft():