Profile photo for Wesley Chun

My take: it depends on your dependencies. If you're starting from scratch, do Python 3. It represents the future of the language as all development has stopped with 2.x, save for security & bugfixes. However, if you have dependencies, i.e., rely on code that's only on 2.x, learn Python 2 but keep upgrading and migration in mind. (Python 2.6 & 2.7 have migration and back-ported 3.x features so you can code in a partially 3.x-way to help get you kickstarted. It's not a good idea to use any version older than 2.6 for this reason.) Regardless of which version you learn, it'll be easy to pick up the other.

I also partially address this question in the reading list I did several years ago (A Python Reading List by Wesley Chun (A Python Reading List by Wesley Chun)) and in the "From the Author" section of my book's Amazon page Core Python Programming (2nd Edition).

I give periodic talks on this topic at conferences... vids or slide decks below:

Also see this page: Python2orPython3 - Python Wiki

May 2015 UPDATE: Another approach is that if you are learning Python 2, there's nothing wrong with "futureproofing" your code and writing code that runs in both 2.x & 3.x. For example, many developers know that print changes from a statement to a function and raw_input() changes to input(), so add this snippet at the top of your Python 2 source files so you can use print() and input() as they are in 3.x:

  1. from __future__ import print_function 
  2.  
  3. if hasattr(__builtins__, 'raw_input'): 
  4. input = raw_input 

... then you're effectively done with this part of your migration to Python 3, leaving only the most essential portions of your app to port. Also check out these 3.x compatibility libraries: six (six), python-future (future), and modernize (modernize) which feature this type of "ifdef" code so you don't have to clutter up your source with it all.

View 84 other answers to this question
About · Careers · Privacy · Terms · Contact · Languages · Your Ad Choices · Press ·
© Quora, Inc. 2025