Skip to content

Comment on Ask HN: Help me understand Python 2.x vs 3.x

Comments

If you're a daredevil you can write your code in Python 3 directly. As you said, some service providers don't offer it yet, and some third party libraries aren't compatible with it.

What most developers do to support both Python 2 and 3 is to write the code in as-portable-as-possible Python 2 and convert it using the '2to3' tool (or similar, more intelligent tools, do a search) before each deployment/release.

Portable means "use no modules that are deprecated in 3.0", using modules that simply have another name is OK. Language constructs are (usually) simply converted. In that case you have to test in both Python 2 and 3.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.