[DB-SIG] Result Set Inconsistencies

Orr, Steve sorr at rightnow.com
Wed Jul 16 16:50:49 EDT 2003


> Both lists and tuples follow the sequence specification. 
So do strings...

Lists are mutable so there's more you can do with them. 



-----Original Message-----
From: Chris Cogdon [mailto:chris at cogdon.org] 
Sent: Wednesday, July 16, 2003 1:17 PM
To: Orr, Steve
Cc: db-sig at python.org
Subject: Re: [DB-SIG] Result Set Inconsistencies



On Wednesday, Jul 16, 2003, at 11:58 US/Pacific, Orr, Steve wrote:

> I know the spec calls for sequences but why? Why be vague on an API 
> "spec?" Intentional inconsistency? So if I'm developing against 
> multiple databases and I want consistent result sets I have to know 
> the behavior of each module and convert types? Seems weird to me.
>
> I'm thinking results sets should always be a lists or I should be able

> to specify how I want the result sets. I know there are lots of 
> differences in database engines and an API can't make all database 
> engines behave the same but it OUGHT to impose SOME consistency.

Both lists and tuples follow the sequence specification. Ie, you find 
out their length, get elements and slices all using the same syntax. 
For example, where 's' is some sequence.

length = len(s)
element_4 = s[4]
a_slice = s[2:4]
for i in s:
	print "element", i

All of the preceding work the same regardless of whether 's' is a list, 
tuple, or a PgResultSet


You don't need to know if they're a list or tuple or anything else in 
most circumstances. In other words, it IS consistent, but not the level 
of consistency you're after :)


-- 
    ("`-/")_.-'"``-._        Chris Cogdon <chris at cogdon.org>
     . . `; -._    )-;-,_`)
    (v_,)'  _  )`-.\  ``-'
   _.- _..-_/ / ((.'
((,.-'   ((,/   fL




More information about the DB-SIG mailing list