2

I'm given a task of converting a bunch of codes written in Python 2.7 into Python 3. So my question is What are the fundamental differences between the two and what are the new features expected from conversion? I'm assuming it's not just syntactical issues. Where should I start and what should I focus on? It'll be more helpful if you could be as concrete as possible.. Please help me out and thank you in advance

3 Answers 3

4

Definitely start here: http://docs.python.org/py3k/whatsnew/3.0.html

For an automated tool, see: http://docs.python.org/library/2to3.html

Sign up to request clarification or add additional context in comments.

3 Comments

I know this is a dumb question, but how do you actually install it? I can't seem to find the download link..
I found svn.python.org/projects/sandbox/trunk/2to3 but don't know what to do with the files to install it...
2to3 should be already installed with your Python. If you can type python from a prompt and have it run, then you should also be able to run 2to3 the same way.
2

Building from Greg's answer I find find it easier to grok the changes by looking at different compatibility layers people have built in order to support 2 and 3 in parallel.

To use a compatibility layer or not is a widely discussed topic, however they are a good programmatic reference too scope the major changes and what you need to do in order to support them.

Comments

1

By far the easiest way is to use 2to3 and maintain two branches concurrently for a while. See this article on the python.org wiki.

There's also an entire website with detailed information, which is basically the contents of a book on the subject.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.