Andreas Jung wrote:
Python: somelist.sort(cmpmethod) Zope: sequence.sort()
Both methods are well documented.
Hi Andreas, I am not big pythonist, just little beginner and I was think that object language was able to do for i in self.objectItems('Folder').sort() But it does not. So I was try ids = self.objectIds('Folder') ids = ids.sort() for i in ids : TypeError: object of type 'string' is not callable But I was get following tip: a=context.objectItems() a.sort(lambda x,y: cmp(x[0],y[0])) for i in a: And that works fine. But I absolutelly does not understand to that. And my ideas about object programming was get one big hole. Thanks to all which helps me. Best Regards, JL.
I have python script that does
for i in self.objectItems('Folder')
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])
Under Zope DTML it is very easy:
<dtml-in "objectItems('Folder')" sort=id>
But under python?