[Zope] how do I test for the current item in an iteration

Andreas Jung lists at zopyx.com
Fri Sep 28 11:41:55 EDT 2007



--On 28. September 2007 16:36:43 +0100 kamal hamzat 
<hamzat at dnetsystems.net> wrote:

> Dear All,
>
> I have this error after i added the if statement
>
> Error Type: TypeError
> Error Value: mybrains.__cmp__(x,y) requires y to be a 'mybrains', not a
> 'int'
>
>
> for i in context.zCatNewsCurrent():
>      if i <= 5:
>         print "%s: %s: %s" % (i.id, i.author, i.summary)
>
>         return printed

Look at Python's enumerate() method.

-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/20070928/08e25a35/attachment.bin


More information about the Zope mailing list