Recommendations (or best practices) to define functions (or methods)
"Martin v. Löwis"
martin at v.loewis.de
Mon Jan 8 02:25:13 EST 2007
vizcayno schrieb:
> Need your help in the "correct" definition of the next function. If
> necessary, I would like to know about a web site or documentation that
> tells me about best practices in defining functions, especially for
> those that consider the error exceptions management.
I agree with George Sakkis' remarks. The best way to define this function is
def ExecuteSQL(cmdSQL, cursor):
return cursor.execute(cmdSQL)
If this raises an exception, it likely means there is something
wrong with the SQL statement. The program should abort, and the
developer should correct it.
Regards,
Martin
More information about the Python-list
mailing list