Em Ter, 2005-03-29 ās 17:21 +0200, Florent Guillaume escreveu:
> martin f krafft <[EMAIL PROTECTED]> wrote:
> > also sprach Florent Guillaume <[EMAIL PROTECTED]> [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.
Leonardo Rochael Almeida <[EMAIL PROTECTED]>
Zope-Dev maillist - Zope-Dev@zope.org
** No cross posts or HTML encoding! **
(Related lists -