This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author bobbyi
Recipients benjamin.peterson, bobbyi, eric.araujo, hfuru, loewis, vstinner
Date 2010-11-13.01:28:52
SpamBayes Score 6.707825e-08
Marked as misclassified No
Message-id <1289611734.06.0.674944392154.issue10070@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2010-11-13 01:28:54bobbyisetrecipients: + bobbyi, loewis, hfuru, vstinner, benjamin.peterson, eric.araujo
2010-11-13 01:28:54bobbyisetmessageid: <1289611734.06.0.674944392154.issue10070@psf.upfronthosting.co.za>
2010-11-13 01:28:52bobbyilinkissue10070 messages
2010-11-13 01:28:52bobbyicreate