Python 2.3 Breaks PySQLite a Little

Gerhard Häring gh at
Thu Aug 7 11:15:53 CEST 2003

Greg Brunet wrote:
> "Gerhard Häring" <gh at> wrote:
>>[1] And I intend to drop all this politically correct isinstance stuff
>>in  a future version for performance reasons.
> Hey Gerhard:
> What will you be using to replace it with that will improve the
> performance?  Is just doing a: type(value) that much faster?

Well, my plan is to rewrite PySQLite completely in C (maybe using PyRex).

You're right, it doesn't make a big difference if you use issubclass() 
or type() in an if-elif chain. But using type() makes it possible to use 
a dictionary to map types to quote functions, which *should* be faster. 
Note the "should" ;-)

I'll have to benchmark a little more. However I really want to add the 
feature of being able to register new quote functions without 
subclassing the type in question and adding a _quote() method, which is 
currently the only way. Apart from directly hacking the PySQLite 
sources, like you did ;-)

-- Gerhard

More information about the Python-list mailing list