29 Mar
2005
29 Mar
'05
6:34 p.m.
Em Ter, 2005-03-29 às 17:21 +0200, Florent Guillaume escreveu:
martin f krafft <madduck@madduck.net> wrote:
also sprach Florent Guillaume <fg@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@hiper.com.br>