On Thu, Jun 5, 2008 at 3:35 PM, Tino Wildenhain <[EMAIL PROTECTED]> wrote:
> Marco Bizzarri wrote:
>>> if result:
>>> result_len = results.actual_result_count
>>> 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
Tino, Janko, thanks for the clarification. I understand the standard
behaviour of list and tuples. But what a Catalog returns is not (if I
understand it correctly) a list or a tuple, even though it presents as
such. It is a subclass of Lazy. Is Lazy behaving like a list or a
tuple, in this respect?
Zope maillist - Zope@zope.org
** No cross posts or HTML encoding! **
(Related lists -