Converting tuples to dictionaries?

Mart van de Wege mvdwege.usenet at drebbelstraat20.dyndns.org
Wed Sep 26 14:06:17 EDT 2001


In <mailman.1001492608.12682.python-list at python.org>, Simon Brunning wrote:

>> From:	Mart van de Wege [SMTP:mvdwege.usenet at drebbelstraat20.dyndns.org]
>> > This is definitive -
>> > <http://www.python.org/topics/database/DatabaseAPI-2.0.html>.
>> I've seen the docs on python.org, but they appear to be not quite complete.
>> According to dir(cursor_object) there are a couple of methods not covered in
>> the API description. Also, I'm having a little trouble understanding exactly
>> what arguments the methods take and what they return.
>  
> Hmmm. AFAIK, if this document is inaccurate, then it is *definitively*
> inaccurate! This is the *specification* of the DBAPI-2.0.
> 
> You don't mention which DB module you are using, but is it possible that it
> *extends* the API? (mxODBC does for example, IIRC.)
> 
Hmmm. Remember I started this thread with asking how to get my SQL query
results into dictionaries? I found a few methods called dictfetch* in psycopg
(the DB module for Postgresql). I was just wondering on how to use those, but I
can't find them in the docs.
 
>> OTOH I'm not having a lot of trouble finding out what things do with trial
>> and
>> error, and I think I'd have less trouble reading the source than getting my
>> head round OO programming, as I am a procedural programmer originally.
>  
> It isn't easy, I know. After programming for over a decade (in my case), to
> suddenly find that all your knowledge and instincts about how to go about
> designing a program are suddenly totally wrong is disconcerting to say the
> least.
> 
> The only advise that I can get is to keep plugging away - keep getting it
> wrong until you start to get it right. ("Bugger, I shouldn't have made the
> *page* the object, the *paragraph* should have been the object!") Think back
> to when you started to learn to program, and remember how often you got things
> wrong and started all over again back then - you are going to have to go
> through the same thing again.
> 
> You might find "Object-Oriented Design In Java" by Stephen Gilbert and Bill
> McCarty (Waite Group Press, 1998) useful. Little of it is Java specific.

Well,

Fair's fair, I have been and always will be a hobby programmer (my current
project is a database and a set of utilities to manage my D&D campaign), so my
experience isn't that good, but I'm am getting the hang of that OO thing. What
attracts me in Python is that it is very nice in not enforcing OO, so I can
find my own mix of procedural and OO programming. Very Nice indeed.

Dungeon-Master-with-a-geek-streak ly yours,

Mart

-- 
Requiem aeternam dona eis, Domine, et lux perpetua luceat eis.
Requiescant in pace.
Amen.



More information about the Python-list mailing list