Father of Python

Source: Internet
Author: User

Father of Python

On the poster, Guido van rosum, the father of Python, made speeches at the EuroPython 2015 Conference in the form of speeches and on-site Q & A. However, after coming to power, he changed the entire process to on-site Q &. Before answering questions from the audience, he first promoted the meeting process with his own questions and answers. Topics include Python 3 and 3.5). Why is there no version 2.8, why are there so many open bugs, Pypy, And what parts of Python he hates.

Django Girls

Van Rossum's first question was how he looked at Django Girls-the subject of the previous day's speech. He said that this was a great conversation and he loved telling stories. There will be no relevant content or any "pretty slides" in his speech ". When he hears Ola... Or Ola... He was shocked when he painted squirrels and badgers for these slides.

Another aspect he liked was that they affirmed that they did not know what they were doing. It reminds him of writing python 25 years ago, and he does not know what to do next. For example, he does not know that a programming language needs a community with different roles.

He is also infected by the "strong brand" they created in a year, "I expect Ola and Django Girls to go far ."

Python version

His next question is why developers are switching to python 3. "Why can't you give up python 3 ?", He asked himself. But he didn't say that people should be transferred to python 3, but he didn't want them to do it either, but there is indeed a lot of difficult work to spend on something else. For example, the appearance of these applications and websites, python 2.7 is not dead now, and there will be more security fixes, maybe the next five years will be more secure. Porting to python 3 is complicated, so why?

On the one hand, Python 3 is a much better language than Python 2 ". This is a very easy language to teach. For example, the Django Girls studio is fully developed based on Python 3. It is never possible to say that Django developers have not done any junk work based on framework interfaces. In this way, using this language and framework makes the first development experience more pleasant.

Python will get better and better over time. For example, there are "a lot of amazing new things" in Python 3.5 ". He said that Python 2 is an excellent language and will keep its original features as always, gradually approaching the perfect version 2.7. The only way to benefit from all the work done by core developers is to transfer it to Python 3.

A long-standing problem is why Python 2.8 was not released, although Van Rossum pointed out that there may be outdated styles. Python 2.8 cannot solve any problems that people want to solve. There are no new features, which means there is no reason to upgrade the version, and the gate for porting from Python 3 has been opened. This will make the program need to be transplanted to both 2.8 and 3.

Unicode is a major obstacle for porting to 3. But "it's time to stop ". Therefore, Python 2 is in a State and does not get any new features. This allows core developers to focus on Python 3 and make it better.

Next he talked about Python3.5, which will be completed in March. He once had no choice for so many features. For example, OS. scandir () has brought about great performance optimization, but in fact most users will not notice it. Other users will be very happy with the new matrix multiplication operator. NumPy and other scientific computation packages will start to use this feature, which is more natural than calling a function.

Perhaps his favorite feature of Python3.5 is the syntax prompt, that is, the pep he made himself. In order for PEP to accept it, he has made a lot of effort to make himself a referee and persuade himself to accept his work. This is also a little strange. However, he still hopes that someone will give him an independent Code Review, just like what Mark Shannon did as a representative of BDFL, he said.

"If you are not surprised by this, the Python3.5 feature accepted by the last PEP is the asynchronous and waiting keywords he is interested in. This will provide a more natural way to write the code about the coroutine ."

Public bug

Recently, someone asked him about all the public bugs in python bug tracking. If you look for a public bug, you will find that the bug may have been patched, and there is a long discussion. Even the core developers say that the patch can be merged into the trunk, but the bug is not fixed. Is this a unreliable core developer or a good guy? So what else do we need to do with these patches?

He said these problems also exist in some other major projects. Many bugs are not closed in the correct way, leading to misunderstanding of the document and accumulating more bugs. These bugs are hard to reproduce due to the differences in hardware or development environments. However, this bug is not patched.

There are also some bugs with functional recommendations and patches, but we usually hesitate to accept these changes because these concerns are useless. For example, it does not have some features of the same language or is backward compatible. It is hard to accept these patches without breaking all the time.

In addition, the core developers themselves have a lot of work, and no one can share the work of merging patches into the Python core code. All patches and features that are not followed by core teams are generally not inserted into the merge process.

In a company, these things are somewhat different. People make payments to people to do boring work, but if it is open source, you must voluntarily complete those unpleasant tasks. Some core developers have been doing this boring job for too long and they want to get away from it. Some open bugs have a long history in the bug tracker, which has many reasons.

In the end, many statistical effects are always ignored. If you randomly notice a bug, including closed bugs, you may get a closed bug. Many bugs are quickly closed and easily fixed, similar to the fast fix. However, the average life of open bugs increases linearly with the age of the project, he said.

GIL

Some audience asked global interpreter lockGIL) to learn more about the problem and how it was solved. Van rosum smiled and asked, "How long have you been ?" He briefly describes the history of GIL. After the birth of Python, multi-core computers emerged. When a thread runs in a different kernel, two or more processors need to update the same object to produce a competition mechanism, especially in the Python garbage collection mechanism.

A reasonable solution is to lock each object so that data is not damaged by multiple access channels. But as a result, locks and locks are expensive when there is no lock competition. Some experiments show that the performance of a single-thread program that does not need to be locked is reduced by two times. This means that only programs that use three or more threads or kernels will benefit from this.

Therefore, GIL was born although the name appeared long after it was added to the interpreter ). It is a single lock that immediately effectively locks all objects, so that all object access will be sorted. The problem is that, 10 or 15 years later, multi-core processors are everywhere and people want to use them without having to perform multiple processing, for example, using independent processes rather than thread communication)

He said that if you want to design a new language today, you need to leave it unchanged or limited. However, the audience came up with "This Is Not Python ". Van rosum agreed: "You have said what I want to say ". There are a lot of developers around GIL, including PyPy software transaction memory STM) and PyParallel. Other developers have broken their heads and are trying to solve the problem. Van and others will be happy to hear if anyone knows how to remove GIL and maintain the Python feature in the language.

PyPy

He was asked whether PyPy uses it and whether it will become the default interpreter one day. He didn't use PyPy, But he downloaded it for a few minutes. He liked what he saw. He uses Python in two modes or writes some small scripts to complete some tasks. He only uses an interpreter that has been installed in his system, or deploy Python to the cluster as a Dropbox engineer.

The Dropbox cluster runs the modified Python 2.7, which caused laughter. "I said, this is not a secret," he said. Because PyPy is faster, some parts of Dropbox are using PyPy. However, the company is worried that some small incompatibility causes some bugs that are not easy to track. "We have encountered many such problems ."

PyPy confirms that you can execute Python faster than CPython. It also provides a testing platform on which interesting ideas such as STM can be tested. However, the conservative principle allows people to use PyPy only when they need to speed up. When you find out the problems caused by this, you are already deployed on many machines, making it difficult to migrate data. Therefore, this is similar to the problem encountered when migrating to Python 3.

Dropbox has many dependencies on third parties, and some cannot be reconstructed on its source code. This is also true for companies that use thousands of lines of Python code in the production environment. He found that Google is also like this and it is difficult to migrate.

In short, PyPy is a "very cool project ". But it has many check boxes and needs to be easier to check. He joked that PyPy may need to rent Ola and Ola from DjangoGirls to create a larger project community.

Favorite

The next five minor problems are his favorite things. What is your favorite web framework? He said that he only writes one web app in any framework, and he finally tried Flask. Favorite Test Library? It mainly uses unittest and mock in the standard library. Editor? He is using Emacs now, but he started to use vi to get cheers from different audiences ). He still occasionally uses vi or Vim), but after five minutes, it takes him 15 minutes to adapt to Emacs.

What is your favorite language except Python? He used to speak C language, but "a little boring ". People he trusts tell him that modern C ++ is a good language. He prefers Go, but does not use it to write anything meaningful. When talking to the designer, he liked to steal a bunch of Swift appearances from Python. It is easy to copy your favorite bad things from a language and end up with a bunch of illogical features, but Swift designers seem to have not done so. Finally, what exceptions do you like? In more cheers and laughter, he gently smiled and replied that the keyboard was broken.

What he hates

The last question is what he hates Python. He immediately replied, "Everything is related to packaging and publishing ". There are always issues related to version crossover and dependency that cause "Endless confusion ". He was afraid that his colleagues would come and ask him "a simple Python problem". Half of them were some input paths and there was no simple solution.

Then his time is up. The EuroPython conference organizer provides each speaker with a gift: A baskeret and a handkerchief. They appear at the end of Van rosum's speech ).

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.