[Tutor] short circuiting

bob gailer bgailer at gmail.com
Thu Jun 25 21:23:03 CEST 2009


Kent Johnson wrote:
> On Wed, Jun 24, 2009 at 11:32 PM, Dave C<realtimethrill at googlemail.com> wrote:
>   
>> Hi
>> I've read that the builtin all() function stops evaluating as soon as
>> it hits a false item, meaning that items after the first false one are
>> not evaluated.
>>
>> I was wondering if someone could give an example of where all()'s
>> short circuiting is of consequence
>>     
>
> It can have a performance impact if the sequence under test is long or
> the comparison is expensive.
>   

Also an item could be a call to a callable object (function, method, 
...?). That can have side effects.

-- 
Bob Gailer
Chapel Hill NC
919-636-4239


More information about the Tutor mailing list