[DB-SIG] Result Set Inconsistencies
Orr, Steve
sorr at rightnow.com
Fri Jul 18 12:09:06 EDT 2003
Regarding:
> The relaxed API spec is a feature
<GRIN> Well... I genuinely appreciate the "relaxed robustness" of Python but I don't think this means we should be relaxed about API specs which should be more exacting. When standards are relaxed they become confusing and degenerate into many colored flavors of interpretation. Remember the beginnings of ODBC and how it had to be tightened up? SQL is a great standard that has had to be tightened up over time and it would have been so much easier if it we more strict and comprehensive from the beginning.
-----Original Message-----
From: Magnus Lyckå [mailto:magnus at thinkware.se]
Sent: Thursday, July 17, 2003 1:06 PM
To: db-sig at python.org; db-sig at python.org
Subject: Re: [DB-SIG] Result Set Inconsistencies
At Wed, 16 Jul 2003 12:36:29 -0600, "Orr, Steve" <sorr at rightnow.com> wrote:
>Why the inconsistencies in .fetch* result sets?
>
>Module fetchall Result Set
>--------- -------------------
>MySQLdb tuple of tuples
>cx_Oracle list of tuples
>DCOracle2 list of lists
The relaxed API spec is a feature, not a bug, in my opinion.
Personally I think a list of tuples (like cx_Oracle uses) embodies the meaning of these types in Python best, but there might be all sorts of implementation aspects that leads interface developers to do it differently.
It's also typical for Python to have such relaxed APIs. The late binding and signature based polymorphism of Python is generally considered a strength, not a liability, and the importance of this flexibility is one reason why it's hard to implement interface specifications for Python.
A key in successful Python programming is to not assume more about data than you need and can... So don't overspecify interfaces. It will just lead to reduced flexibility for no good reason. APIs in most other languages are more strict because most other languages are unable to handle the kind of flexibility that Python can handle.
Since the spec only specifies a sequence, you shouldn't make assumptions like Danny Yoo did in his example. Just becase a program happens to run in a certain context, we can't assume that the program is correct.
--
Magnus Lycka (It's really Lyckå), magnus at thinkware.se Thinkware AB, Sweden, www.thinkware.se I code Python ~ The Agile Programming Language
_______________________________________________
DB-SIG maillist - DB-SIG at python.org http://mail.python.org/mailman/listinfo/db-sig
More information about the DB-SIG
mailing list