Bobby Impollonia <bob...@gmail.com> added the comment:

Consider here:
http://www.sqlalchemy.org/trac/browser/lib/sqlalchemy/engine/base.py?rev=6884:b181f1e53603#L1329
the py3k code uses the "raise ... from" syntax which isn't legal in Python 2. 
Using either  "Approach A" or "Approach B" would prevent the program from 
working in py2k due to syntax errors.

I agree that the markup hrufu proposed didn't solve that problem either. SQLA's 
trick of having the py3k code commented out is the critical part that they add.

Additionally, the runtime cost prevents Approach A from being general solution 
for libraries like SQLA who have put a lot of work into reducing the number of 
function calls and checks in their critical paths.

Approach B isn't a general solution because it requires you to replace entire 
functions at a time. If you have a 25 line function where only 1 line needs to 
be changed for py3k, you either end up with 24 duplicated lines of code, or you 
have to factor that single line out into its own function, confusing the flow 
of the code and incurring runtime cost.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10070>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to