[Zope-dev] Re: [Zope-Coders] Re: Question about procedures

Leonardo Rochael Almeida leo at hiper.com.br
Tue Mar 29 13:34:40 EST 2005


Em Ter, 2005-03-29 às 17:21 +0200, Florent Guillaume escreveu:
> martin f krafft  <madduck at madduck.net> wrote:
> > also sprach Florent Guillaume <fg at nuxeo.com> [2005.03.24.1814 +0100]:
> > > > -        if RESPONSE is not None:
> > > > +        if RESPONSE is not None and ob:
> > > 
> > > You should check 'and ob is not None' too.
> > 
> > ... but ob is false when it is None, no?
> 
> Yes but comparing to None is faster, and in some cases (REQUEST for
> instance), much much faster, than checking the boolean value.

And not every "False" object is None. A custom object could implement
__len__() and be considered false if it's "empty", or it could implement
__nonzero__() and be considered "false" even when you want to return it.

Cheers, Leo

-- 
Leonardo Rochael Almeida <leo at hiper.com.br>



More information about the Zope-Dev mailing list