Fixing bool(), MRO and License

I didn't get the wa MAX(id) is faster than COUNT(*) if it needs to run and compare all values from the DB.
In the other hand I also fixes the MRO (it didn't complain in 2.X not sure why) and I added a license.

As far as I know many companies prefer to have a well known open source license which lets them work than just "public domain" which falls in a grey area which many lawyers do not recommend.
OK,…. I send you the fix with the python3 patch in a while, but please make a review.


On 21 Jul 2014, at 21:47, Radim Řehůřek <notifications@github.com> wrote:

> In sqlitedict.py:
> 
> > @@ -128,9 +130,9 @@ def __len__(self):
> >          rows = self.conn.select_one(GET_LEN)[0]
> >          return rows if rows is not None else 0
> >  
> > -    def __bool__(self):
> > -        GET_LEN = 'SELECT MAX(ROWID) FROM %s' % self.tablename
> > -        return self.conn.select_one(GET_LEN) is not None
> > +    def __nonzero__(self):
> > +        # No elements is 0, otherwise True
> > +        return bool(len(self))
> But this calls count(*) -- unacceptably slow.
> 
> I wouldn't expect a full database scan for just writing if sqlitedict_object: ... test, that's a really nasty gotcha.
> 
> —
> Reply to this email directly or view it on GitHub.
>