Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python - Should one start a new project directly in Python 3.x?

Tags:

python

What Python version can you please recommend for a long-term (years) project? Should one use 2.6+ or 3.x is already stable? (only standard libraries are required)

UPDATE: according to the answers below, Python 3.x still has critical bugs. Please also see Python's list of bugs.

like image 353
psihodelia Avatar asked Dec 17 '09 13:12

psihodelia


People also ask

Can a program written in python 2 run in Python 3?

To make your project be single-source Python 2/3 compatible, the basic steps are: Only worry about supporting Python 2.7. Make sure you have good test coverage (coverage.py can help; python -m pip install coverage ) Learn the differences between Python 2 & 3.

What are the differences between Python 2 and 3?

Python 3 is more in-demand and includes a typing system. Python 2 is outdated and uses an older syntax for the print function. While Python 2 is still in use for configuration management in DevOps, Python 3 is the current standard. Python (the code, not the snake) is a popular coding language to learn for beginners.

How do I know if a script is Python 2 or 3?

If you want to determine whether Python2 or Python3 is running, you can check the major version with this sys. version_info. major . 2 means Python2, and 3 means Python3.


1 Answers

This is why you should use Python 3.x:

Python 2.x:

>>>True = False
>>>True
False

Python 3.x:

>>> True = False
  File "<stdin>", line 1
SyntaxError: assignment to keyword

Source: Strangest language feature

Prejudice: But so many packages are not Python 3 ready yet

This is (a) not true (source) and (b) not important to a beginner.

like image 75
Martin Thoma Avatar answered Oct 16 '22 10:10

Martin Thoma