[DB-SIG] PEP 249 clarification
Stefan C. Kremer
skremer at uoguelph.ca
Wed Apr 21 20:00:02 CEST 2010
The "fetchall()" command returns a list. Lists are mutable objects in python. Could a valid implementation return the same list object (with different contents) for multiple calls to fetchall() (with potentially different preceding execute queries)?
cursor.execute( """SELECT * FROM table1;""" );
result = cursor.fetchall();
cursor.execute("""SELECT * FROM table2;""" );
junk = cursor.fetchall();
Is it possible, in a valid implementation, for the two print statements to generate different output (which would be the case if, for example, the fetchall method used an internal list which is a member variable of the cursor object in its return)?
It seems to me that it is important for implementors and users of a DBI to understand the implications of this.
Dr. Stefan C. Kremer
Dept. of Computing & Information Science
skremer at uoguelph.ca * 519-824-4120x58913
More information about the DB-SIG