Jesús Cea Avión <[EMAIL PROTECTED]> added the comment: I think that "-1" is a sanity check. If the count is updated in the database, but it is not transactional (or there are bugs, or the DB is updated by a not up-to-date library, and so on), the cached counter and the real data can diverge.
Anybody using "Berkeley DB" related databases knows that "length" is costly. By good reasons, actually :-). Checking for empty databases should be fast, nevertheless (just iterate over the first item in the database). We could simply define a "__nonzero__()" method for that. That would solve the "if" issue. __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2159> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com