Do you watch Python 3?

Source: Internet
Author: User

Reply content:

Because Unicode,python3 is going to turn into a mainstream. In the 3.0 era, I began to turn to Python to write my own scripts, because Python 2.x is too tangled in Chinese coding. However, the current Python 3 library is still too small, although more and more libraries began to support. In addition, I wrote the GAE program, using Python 2.5, with very uncomfortable. Personally, the next year or two, Python 2.6/2.7 is the most widely used, but will eventually be replaced by 3.x. I am optimistic about the development of 3.x. Xie @ Hu Sakura invited, flattered.

Python I use two versions, mostly Python 2. Most projects are now built on top of Python 2, and OS X's own Python interpreter is also 2.

The main difference between personal feeling 3 and 2 is that the encoding problem is finally resolved, and the default Unicode is. That's why it's so much easier to deal with non-English strings. Before writing a script to send messages via ADB to Android App, Python 2 Chinese string encode/decode out a lot of strange problems (such as the specific character conversion error, the other characters are normal), so far no solution, let me very helpless. Another change is that print has finally become a function, which is consistent with other languages.

To migrate from Python 2 to 3, the biggest problem is that many of the widely used libraries have been renamed, merged, and altered, such as the urllib2 of the 2 era, which is widely used as a crawler. Search the web for Python crawlers, 99% of the articles are introduced in the use of URLLIB2, but Python 3 inside Urllib2 was merged into Urllib, interface and so on, I did not find any documentation on the migration method.

The Python development team's attitude towards 2 and 3 is also one of the reasons why 3 is difficult to advance. Two versions parallel development, isn't it obvious that the version split is getting worse? It is better to learn earlier Microsoft to cut the Python 2, long pain than short pain, the development team also eliminate the hassle of two versions at the same time. I'm looking at python4. If your work is much more relevant to text processing, then it is recommended to be 3.
2.X of Chinese processing makes you want to die

Beginners Python in the choice of Python version may have some doubts, in the end choose Python2 or Python3 it? Or more precisely, is python2.7 or 3.3 (these two versions are the current mainstream)? What is the difference between the two versions? Recently I have seen a lot of people on Google and so on the point of view, specifically to summarize, may be able to answer this moment in your mind doubts.

Wikipedia gives a very detailed explanation of the differences between the two versions of python2.7 and 3.3. Each of these two versions is good for you, depending on what you want to get. But, in general, "Python 2.x is legacy, Python 3.x are the present and the future of the language"

The main difference, or the most obvious difference, is the print function, in Py2 we can print "Hello world!" directly, but the syntax in Py3 is print ("Hello world!").

In addition, PY2 has better support for library functions, and many libraries support only Py2 and do not support Py3. So this is a very powerful advantage of choosing Python2.

But many people, including many Python developers, are staunch Py3 supporters, and ArchLinux also uses PY3 as the default version. Why is it? Because Python3 is the future trend of the version, more and more new features will only support Py3, so it seems Py2 a bit stagnant. Py3 is the mainstream of the future.

So much so, as a beginner, or a developer, how to choose the Python version? I think an answer to that is very good:

"Python 3 is a nicer and more consistent language, but, there are very limited Third-party module support for it. This was likely to being true for at least a couple of years. So, all major frameworks still run on Python 2, and would continue to do so for a significant time. Therefore, if you learn python today, you should learn Python 2, because that's the version you were going to end up Actua Lly using. "

Translation: "Python3 is a better and more persistent language, but the third-party libraries that support it are limited. This situation is likely to persist over the next few years. As a result, almost all of the frameworks will run on Py2 in the present and in the coming days. So if you're a beginner, you should learn Python2, because that's what you end up with. ”

Although this person gives the choice Py2 the answer, but the final decision is in your hands, after all, this is an inconclusive answer.

3.0 certainly no one to use, now 3.x of the latest release is already 3.2 / http Python.org/download/rel eases/3.2/

Personally I might wait until 3.3 official release start trying to use Python 3.x
Enter production at least wait until the common library support Python 3.x there is no optimistic about the problem, 3 is the trend, but the mainstream of the library are not supported 3. And so django,mysqldb all support, with 3 of the times will come. Anyway 2.7 is the last version of 2.x. What does that have to do with bullish or not?

Python3 's non-backwards compatibility is the result of the development of Python. A strong decision to inject more vitality into python. The archaeological team dug a good grave = =

If it was the time of the question (2011-03-23), I was pessimistic about Python 3, since the Python 3 version was 3.2. The most painful egg is the Unicode U-prefix string in Python 3 is SyntaxError, I know these small things can be automatically repaired in 2to3, but quite a lot of people, at least including me and the author of SQLAlchemy, are very dislike of 2to3, I think 2to3 interfered with my control of the code, the problem depends on whether it is my problem or 2to3 their own problems, Unit test plus 2to3 what the trouble died and in the recent SQLAlchemy 0.9 's what's quite high-profile mention
targeting Python 2.6 and up now, Python 3 without 2to3
What's New in SQLAlchemy 0.9?
This order is even higher than the more substantial C Extensions supported on Python 3, of course you can also understand that it is important to 2.6+ this

The second egg hurts is Python 2.7 has almost all the new features of Python 3.0 ~ 3.2 Backport, so you let me have what power to use Python 3? And at that time N multi-Library incompatible, especially Paramiko, to now is not compatible, and unlike mysqldb have alternative-_-| | | , the fabric of the upper layer is also implicated

But after 3.3 is very different, first of all the most painful u "" syntaxerror no, and then finally have a new feature has wood, generator delegation function let me drool ( ̄" ̄), of course, pure to generator with a little big only small use, sure , 3.4 (now still in the RC stage) Asyncio is using this new grammar ( ̄" ̄).

After the release of 3.3 I finally had the motivation to modify my code, ready for Python 3 compatibility Wait for migration, of course ... Even though the unittest are over, we have to wait and see.-_-| | |
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.