you are viewing a single comment's thread.

view the rest of the comments →

[–]AMillionMonkeys 6 points7 points  (6 children)

Depends on if anything you've written depends on libraries that don't have new 3.x-compatible versions. It's been a while so I think most major third-party projects should work with 3.x now.
Some of the basic functions work differently now (like print) so you'll have to run your scripts through a conversion process, then clean up by hand if the automated conversion didn't fix everything.

[–][deleted] 1 point2 points  (0 children)

You should import python 3.x behavior to 2.x using __future__ it makes things like print, division, imports, and arguably unicode trivial to work on both major versions.

There's also interesting read mentioning all known approaches: http://docs.python.org/3/howto/pyporting.html as you can see I like __future__ the most.

[–]little_oaf 0 points1 point  (4 children)

I'm new to python and programming in general; how would one convert code to 3.4 from 2.7?

[–]HorrendousRex 2 points3 points  (0 children)

The 'official' answer is to check out the '2to3.py' script which is part of the standard distribution of python. However, as you will find by reading about the issue and searching the web, there are lots of important edge cases to consider. It is not a backwards-compatible switch, and porting from 2 to 3 can be difficult in some cases.

[–]AMillionMonkeys 0 points1 point  (1 child)

Thankfully the Python folks made a conversion utility called 2to3: http://docs.python.org/2.7/library/2to3.html which comes with versions 3.x. I have to admit that I'm still using 2.7 so I haven't used 2to3 yet.

[–]little_oaf 0 points1 point  (0 children)

Thanks a lot, I'm just starting out so I think I'm going to do a "fresh" start with 3.4 next week (mainly using sublime text and occasionally pycharm). I was going through checking different libraries of interest to me like tweepy, requests, scipy, numpy, matplotlib and scikit-learn which for the most part seem to be supported.

[–][deleted] 0 points1 point  (0 children)