[Zope] sorting

Andreas Jung lists at zopyx.com
Thu Jan 25 15:06:29 EST 2007



--On 25. Januar 2007 15:03:19 -0500 Kate Legere <klegere at kfpl.ca> wrote:
>
>
>         values=ao.objectItems(items)
>
>         values.sort(lambda a,b: cmp(a[0],b[0]))
>
> Error Type: AttributeError
> Error Value: 'tuple' object has no attribute 'sort'
>

This error message is self-explaining. You can only sort lists, not tuples.

>
>
> Obviously, id isn't really what I wanted to sort by anyway but since I
> can't even do that I can't really go on to try to

Look at the 'sequence' module and the 'sequence.sort' method as documented
in the Zope Book 2.7 Edition.

-aj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20070125/42fb2a82/attachment.bin


More information about the Zope mailing list