Hi,

Marco Bizzarri wrote:
...
if result:
  result_len = results.actual_result_count
else:
  result_len = 0

return result_len

...

Thanks for your answer, but there is something I do not understand:

if results:

an empty result from ZCatlog is false in a boolen condition?

Yes, thats standard Python behavior, empty lists, dictionaries
and similar objects are assumed "False" when used as boolean.

This means you could even write it this way:

return (results and results.actual_result_count) or 0

in python2.5 (not yet supported by Zope) even:

return results.actual_result_count if results else 0

Cheers
Tino

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to