8 Jan
2004
8 Jan
'04
10:11 p.m.
On Thursday 08 January 2004 09:56 am, Jaroslav Lukesh wrote:
I want to sort by value of i[0] before "i" is taken to FOR. So it is possible to do something like
for i in self.objectItems('Folder').sort(i[0])
The reason this doesn't work as written is because the .sort() method works in-place and does not return a value. Also, sort needs a function that does the comparison. You want: values = self.objectItems('Folder') values.sort(lambda a,b: cmp(a[0],b[0]) for i in values: # do stuff pass Cheers, Terry -- Terry Hancock ( hancock at anansispaceworks.com ) Anansi Spaceworks http://www.anansispaceworks.com