Comment 9 for bug 612351

Revision history for this message
Julian Edwards (julian-edwards) wrote : Re: [Bug 612351] Re: ResultSet doesn't implement __nonzero__

On Monday 02 August 2010 09:38:37 Jamu Kakar wrote:
> Instead of using __nonzero__ we recommend using
> ResultSet.is_empty(). I do wonder if it's worth adding
> __nonzero__... on the one hand it feels like it could be nice
> (obviously people are asking for it), on the other hand it feels
> magical and that it would be better to just use is_empty.
>
> Is there a case where is_empty is not sufficient?

I think in theory it's fine to use is_empty (I hate magical stuff too), when
we migrate code from SQLObject it should use that instead although for
convenience __nonzero__ would be nice to have.

I had a look at the code for is_empty and it seems it's got the same problem
that you fixed recently for SQLObjectResultSet.__nonzero__ where it's not
removing the result ordering before issuing the query. I think .any() should
be doing that as well?