Questions and answers about Python Programming

Source: Internet
Author: User

Questions and answers about Python Programming
Q & A introduction to Python Programming

About a month ago, oschina.net and Chapter Hua jointly held an activity: OSC 51st master Q & A-talk about those things in python to promote the book I wrote: Writing high-quality code: 91 suggestions for improving Python programs (Douban link ). In the process of answering the questions, I saw several people asking questions, and then I came up with the idea of sorting out these questions and answers afterwards, the following content is from that Q &. In order to simplify the sorting, the nickname of the person who asked the question has been removed and a simple classification has been made.

Tangle of Py2 and Py3

Q: What is the prospect of Python 3? Is it always split from 3 in the end? Use your own version?

A: Since the release of py3, it has made great progress and solved many problems that py2 cannot solve. Therefore, I firmly believe that everyone will eventually switch to py3. Currently, py3 has many attractive features, such as yield from, asyncio, and more beautiful database structures. However, I admit that py3 has not had a huge attraction for everyone to turn over. yield from is half the one, and the other half is jit. Imagine that py3 has its own jit, the running speed is 3 to 10 times that of py2. I think py3 is the future, but I agree that the two split versions affect promotion.

Q: Should I start 2 or 3? 2 will it be abandoned by the Python team?

A: Learning py2. It would be easy to switch to py3 at that time. However, if you learn py3 directly and use py2 for the project at that time, you will feel the pain of luxury.

Q: How long does it take for you to become mainstream in Python3.x?

A: There is still A long time, but if py3.5 has an exclusive, reliable, and official jit solution, it will accelerate A lot!

How to Learn Python

Q: Is Python a programming entry language.

A: considering employment, I think C language is more suitable for entry.

Q: How advanced is python learning? How can I learn basic knowledge?

A: If you are already working, simply try to solve your work needs using python. If you are A student, copy the existing website, get all its functions, such as oschina.

Q: How do I write high-quality code and improve the quality of my code?

A: personal opinion: 1. familiar with the details of the language; 2. Familiar with the best practices of the language and database; 3. Read more guidance books to improve the code quality; 4. peer review; 5. Learn more languages.

Q: Are there any suggestions for a java developer to learn how to use python?

A: Learn it like learning java in the past.

Q: What are the best websites for beginners to learn?

A: I 'd better read books and manuals. The website's knowledge is too scattered and is not systematic, so it is easy to become A programmer.

Q: After learning and using python for a while, How can I improve my python usage capabilities?

A: My answer is to repeat some products, such as trying to make A Douban or oschina.

Q: Is this book "Writing high-quality code: 91 suggestions for improving Python programs" suitable for other non-Python programmers?

A: Not suitable. It is positioned as a person who knows something about python. This positioning has been promoted to intermediate and intermediate python programmers.

Q: I recommend several excellent Python open-source projects for learning.

A: An excellent python open-source project. I 'd like to have A look at trac and reviewboard?

Q: What do you think are the best books about Python since you learned Python? Language basics, language design, and framework. Thank you.

A: I think I can answer A very good question, because I think my book is not the "best" level. We recommend expert python programming and Python source code analysis.

Q: Hello, I have a question to ask you how to become a real pythoner. I used to work on C ++. Now I am working on some python web tasks. When I first came into contact with python, I learned some basic syntaxes and started to write algorithm-related programs. Therefore, when I wrote python programs, the Code still had the shadow of C ++, until now, when maintaining other people's python web programs at work, I found that my python program is too unelegant. Many times, some functions can be implemented in a more beautiful, faster, and more efficient way, however, I may want to build and control my program from the bottom layer like C ++. Later I found that some lines or even shorter code can be used to implement those functions, the execution efficiency is also better, so I found that writing python programs cannot use the previous idea of C ++ code. Maybe I can try to use pythoner more?

A: An interesting question. My personal suggestion is as follows: 1. read through the manual, especially the lib ref and lang ref. The so-called "familiar" means that you can write more pythonic statements only when you are familiar with the language; 2. Read the documentation of the classic python project, such as flask, such as pip, to see what mechanisms they provide and even how they are provided. 3. Don't worry, just write more python code.

Python application puzzles

Q: Is Python suitable for developing complex web projects?

A: In my opinion, python is suitable for developing large, medium-sized, and complex projects. The most critical factor is human. Python has good support for the web, many third-party libraries, django/flask, and many others applaud the framework.

Q: Which operating system is better for getting started with Python? I only learned a little about the basics in Windows, but I don't know what the actual team development environment is like. Can I introduce it? Thank you!

A: We have been using linux as the production environment. mac OS x is my development environment. I have been using windows for many years. I don't think using windows will affect your learning.

Q: currently, python seems to be mostly used for WEB applications. What can be used to develop python in C and C ++?

A: It mainly utilizes the flexibility of Dynamic Language and the convenience of interpreted language, to solve the problem that C/C ++ is too costly or unable to cope with changing business needs and rapid deployment.

Experience

Q: Is it feasible for students to develop in PyQt only?

A: In the long run, as long as there is A breakthrough, it is very likely that there will be achievements in the future. In the short term, it seems that the employment is narrow.

Q: I feel that python can do everything, but it is difficult to do well. Without the c/c ++/go extension, can python make a system with high throughput, high concurrency, and high stability?

A: I can say that python can do anything, but I still overestimate it. But it is difficult to say that python is very good. I have to look at the definition of the word "very good". It is estimated that the standards of each person are different. I don't know much about it. It seems that there is no mature solution for python extension using go? In terms of online games and websites, I think we can also develop high-throughput and high-concurrency systems, but the hardware costs may be slightly higher. As for stability, the decisive factor is the quality of developers, which has little to do with the language. Even c/c ++ is easier to develop Unstable Systems.

Q: How can I quickly find the class library I need when python class libraries and function libraries are huge?

A: This is A problem. Many languages have the same problem. Would you like to take a look at the awesome-python project first?

Q: What is the income of python programmers?

A: It seems that I have seen the annual income from tens of thousands to hundreds of thousands, but I have not seen the income of millions. In general, I think it is similar to other languages, but the percentage of high salaries may be relatively high.

Q: I was a ruby programmer. Later I saw many python modules, such as ipython and ipython notebook, in fact, python is far less flexible than ruby (method_missing and so on), and the design philosophy is different. I would like to ask why python is more than ruby? Especially scientific computing (Numpy) and plotting (matplot )?

A: The reason why python is so popular in the scientific community is said to be because scientists are not computer professionals and think python is easy to learn and use, it's just a one-time write script to run the test data.

Q: Can I ask if python is used to write games? It is not said that python is relatively slower than c ++/c, now most of the game engines are c/c ++. Let's look at Cocos2d, which looks like the python version first, and then is rewritten using c/c ++, although the Python version is also updated, the development of various mobile software games is also popular, and python seems to be unable to keep up with it in this regard.

A: Yes. In the mobile game era, python is no longer suitable for compiling clients. You can try to use it on the server.

Q: I have a few questions: 1. does multi-framework and multi-module implementation language represent the cost of Multi-learning? 2. the existence of the glue language is mainly used to do what it is and how it is applied on other layers. 3. unix-like system management, how to learn about them 4. what are the differences between Web and ruby, or advantages and disadvantages? 5. text crawlers are slightly different in character sets and platforms. How can you avoid this problem?

A: 1. I don't quite understand what multi-framework and multi-module means. Can I understand that python has many frameworks? If so, I don't think it represents more learning costs. Take a look at quick-start, examples, and the extension and splitting mechanisms in doc, you will find out whether this framework and module is suitable for your technical view. If it is not suitable, you will not learn it. If you do not learn it, there will be no cost. 2. for the question of the glue language, I think the book "unix programming art" talks much better than I do. It is recommended. 3. I don't know much about sa. I suggest reading monographs. 4. the advantage of ruby is that there is a big unified solution like ror. python has many options, and there are more troubles. 4. text processing has many coding problems and is difficult. It is recommended to use chardet and other solutions, but they are both powerful and difficult. We recommend that you accept some of the problems that cannot be solved.

Q: I would like to ask the following questions: (1) how to implement efficient python coder? I started using python in the last two years, however, I think there are still many improvements to the efficiency of activation, as compared with the internal java Group of the company. (2) One of the things I like in python is relatively clear, and everything is relatively original, which is equivalent. net is too packaged, which is its strength. If lib is ready-made, you can find it. I would like to ask what is commonly used at ordinary times. It is best to build lib by yourself, or is it better to directly use the lib written by others? Thank you (3) is python more suitable for web writing or a better choice? Compared with the domestic environment, python is really less on this aspect. Of course, google is the leading brother in foreign countries, and many projects in this phase are brilliant, I am now working on a web project and selecting bottle. It is similar to flask, and the speed will be better. I found that many technical problems have been encountered in the project, the number of materials that can be queried is relatively small, making it quite difficult to solve the problem.

A: 1. How to make an efficient python coder? I think it is no different from other languages. In any case, reading more official documents is definitely A huge gain. This is also my experience. 2. I usually use the lib written by others directly. If yes, it will be helpful. 3. We recommend that you select a large and active framework in the community such as flask/django.

First-line encoding

Q: I personally feel that python does not have a mature IDE. Writing programs keeps turning over documents, and I don't want to write C ++ or use eclipse. All of them are automatic prompts + documents, I want to know whether I am really easy to learn or a common problem in python development?

A: Well, there is actually no really powerful IDE. pyCharm is good, and there is A free community edition. If you are used to remembering it with E, you can try pydev.

Q: I would like to ask whether every python import module will instantiate or share an instance in the memory.

A: One is shared by default.

Q: What tools do you use to package a python project? After I use pyinstaller to package a program containing gtk, the packaged file will report that the _ glib module does not exist. I don't know if there are any better tools. It is best to use cross-platform.

A: We generally do not install the installation package. We generally use setuptools.

Q: The type of the return value of the python "function" is not included in the statement syntax declaration. Because the return value type is not so clear in the python Development Project, how can we ensure that the return value type is not wrong in software iteration?

A: On the one hand, everyone follows some best practices, such as ensuring that the returned values are of the same type; on the other hand, they fully perform unit tests; and on the other hand, they use newer python versions, the type declaration of parameters and return values is supported.

Q: What good libraries are available for the python coroutine?

A: It must be A gevent.

Q: Does Python have a mature tool chain like RVM, Bundler, and Rake in the Ruby community?

A: Yes. You can check it out at pypi.python.org. The usage of these tool chains is also mentioned in my book.


Python Programming Problems

The language details are basically enough for python documentation.
But it seems to be a lot of: Check the python tutorial first. Then let's look at dive into python.

I don't know what the central level you mean? But if you want to be a good programmer, algorithms are indispensable. But this has nothing to do with python.

You can use python to implement the exercises encountered in other language classes. This is a good exercise for beginners.

Video, no need

For python problems, I want to be proficient in python programming. Which of the following is my eldest brother? What should I learn?

1. First:
I know little about hacking.
At best, I used a hand-writing tool that was previously too high. I tried some small functions, but it was not written in python.
2. say to you:
Based on your knowledge, I suggest you:
If you really want to study network security, first learn a lot of basic network knowledge.
That knowledge is enough for you to learn for a long time.

For now, you:
You should first learn python and use python to implement some tools to meet your own needs. After getting familiar with the problem, consider your hacker again.

Python:
Basic aspects:
[Tutorial] Getting started with Python Development

Moderate:
[Arrangement] knowledge about Python Development

In short, you are now like:
I want to modify a sports car, but you have not learned the basic principle of the engine. I am not familiar with how to pull and unload screws. How can I modify a sports car, I can only say:
First, you should clarify the vehicle architecture, familiarize yourself with the basic tools, and discuss how to modify them.
Do you understand?

(No post address is provided here. Search the post title on google to find the post address)

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.