On Wed, Jan 27, 2010 at 03:30:18PM +0000, Matthew Wilson wrote:
> def __nonzero__(self):
> return self.count()
This could led to a potential problem in code like this:
if some_condition:
query = MyTable.select(...)
else:
query = None
if query:
...
There is a subtle bug if self.count() returns 0. Currently people are
accustomed that SelectResults instances are always evaluated to True in a
boolean context.
I don't know, though, how often people write code like that.
Oleg.
--
Oleg Broytman http://phd.pp.ru/ ph...@ph...
Programmers don't die, they just GOSUB without RETURN.
|