TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Writing Python 2.x forward compatible to Python 3 code

94 pointsby bretpiattover 14 years ago

4 comments

davidhollanderover 14 years ago
For web development in Py3k the big holdback has been PEP3333, but it recently stabilized this month which is great news! <a href="http://www.python.org/dev/peps/pep-3333/" rel="nofollow">http://www.python.org/dev/peps/pep-3333/</a><p>Also be aware of the following:<p>There is currently no memcached library for Py3k. <a href="https://github.com/lericson/pylibmc/issues#issue/21" rel="nofollow">https://github.com/lericson/pylibmc/issues#issue/21</a><p>[edit: If you use the uWSGI appserver with nginx or cherokee to deploy, I believe it will have cacheing for Py3k in its .97 release next month]<p>One of the problems is python.org has been emphasizing a Python2to3 without a Python3to2 converter. The ideal situation would be library, framework and module developers write in Python 3 and release a compatibility Python2 version via an automated converter, rather than the other way around. Otherwise they will be forced to do primary development in Python2 and not have the resources to maintain a separate Py3 branch.<p>Link to Python3to2 repository: <a href="https://bitbucket.org/amentajo/lib3to2/" rel="nofollow">https://bitbucket.org/amentajo/lib3to2/</a>
djacobsover 14 years ago
As someone who's learning both right now and not sure which to use, this is invaluable.
评论 #2130681 未加载
viraptorover 14 years ago
&#62; For new projects, start with Python 2.6 or 2.7<p>Unless you want your project used on debian stable, that is... In which case your exception handlers will be simply not compatible between versions.
评论 #2130667 未加载
评论 #2131514 未加载
评论 #2131261 未加载
ylemover 14 years ago
Have any of you looked at the changes in how super works from python 2.5 to 2.6 and how it changes for 3.0? This has bitten me for a library I was using with Django...
评论 #2131259 未加载