[Zope] Sorting objectValues in Python Script
Casey Duncan
casey@zope.com
Fri, 18 Oct 2002 09:35:47 -0400
Ick, no lambda needed:
items = context.objectItems()
items.sort()
for id, object in items:
print id, object
return printed
sort is *much* faster when you don't use a comparison function as well (though sometimes you do need them).
-Casey
On Fri, 18 Oct 2002 10:20:27 +0200
Jerome Alet <alet@librelogiciel.com> wrote:
> On Fri, Oct 18, 2002 at 10:15:10AM +0200, Andreas Tille wrote:
> > Hello,
> >
> > I just want to build a sorted list of
> >
> > list = context.objectValues('ExtFile')
> > for file in list:
> > print file.id, file.title
> > return printed
>
> <UNTESTED>
> list.sort(lambda x,y : cmp(y.getId(), x.getId()))
> </UNTESTED>
>
> hth
>
> Jerome Alet