[Python-3000] Iterators for dict keys, values, and items == annoying :)

Ian Bicking ianb at colorstudy.com
Thu Mar 30 05:28:50 CEST 2006


Greg Ewing wrote:
> On 3/29/06, Adam DePrince <adam.deprince at gmail.com> wrote:
> 
>>>>> rs.execute( "select upc, description, price from my_table" )
>>>>> data = rs.fetch().fieldby( 'price','upc')
>>>>> print type( data )
>> <MultiViewMapping>
> 
> Seems to me it would be a better idea for the DB
> module to return tuple-with-attributes objects for
> the rows in the first place, rather than plain
> tuples.
> 
> When I get around to reworking my custom Firebird
> module, I'm going to make it do that.

I find it fairly useless when database-specific drivers fancy up their 
results, because I can't rely on them, and they all work differently, 
and I have to stick to the lowest common denominator.

Which is off-topic here, except to say that a view on the tuple would be 
useful in a way that returning a fancy tuple would not, because it could 
wrap any DB-API-compliant result set.  Which might still be off-topic, 
since the implementation of that particular view would be mostly 
unrelated to any other view we've talked about here.  Except perhaps to 
note that patterns for building light and fast views would also be nice.

-- 
Ian Bicking  |  ianb at colorstudy.com  |  http://blog.ianbicking.org


More information about the Python-3000 mailing list