[DB-SIG] Optional DB API Extensions

Andy Dustman andy@dustman.net
26 Oct 2001 09:57:58 -0400


On Fri, 2001-10-26 at 08:46, M.-A. Lemburg wrote:
> Andy Dustman wrote:
> > 
> > On Tue, 2001-10-23 at 11:04, M.-A. Lemburg wrote:
> > 
> > >     Cursor Attribute .rownumber
> > 
> > Now implemented in MySQLdb (was cursor._pos).
> > 
> > >     Cursor Method .scroll(value[,mode='relative'])
> > 
> > Currently I have cursor.seek() and cursor.tell(), which work as the file
> > object methods.
> 
> Hmm, not a bad idea... following the file interface here (except
> that .tell() is already available through .rownumber).

Generally speaking, I think I prefer methods to read-only attributes.
The Db-API interface of MySQLdb is written in Python, and I'd rather not
have to deal with __setattr__/__getattr__ hooks if I don't have to. Plus
it is arguably better practice for a user interface.
 
> > >    Cursor Attribute .messages
> > >    Connection Attribute .messages

Similar, why not cursor.messages(), which returns a list of messages
generates, and clears the list, and the same for connection.messages().

-- 
Andy Dustman         PGP: 0x930B8AB6
    @       .net     http://dustman.net/andy
You can have my keys when you pry them from my dead, cold neurons.