Several articles required to learn Python well

Source: Internet
Author: User
Tags python docstring

It is easy to use python as a scripting language, but it is not a day to learn how to write a very nice Python code, the purpose of this article is to recommend some excellent Python-related articles (for books, you can refer to dip, learning Python and the official manual ), this allows you to take less detours on your way to becoming a python guru. Note: All articles are in English. Learning Python well and reading English documents is required.

1. pep8 Style Guide for Python code

The ranking one is the python encoding standard pep8. I don't need to talk about it any more. It must be familiar with both beginners and masters pep8. While following the rules described in this article, you must remember two special words, but do not abuse these two words :)

    Two good reasons to break a particular rule:    (1) When applying the rule would make the code less readable, even for        someone who is used to reading code that follows the rules.    (2) To be consistent with surrounding code that also breaks it (maybe for        historic reasons) -- although this is also an opportunity to clean up        someone else's mess (in true XP style).

If you want to write Python C extension library, you must study pep7 well.

2. Code like a pythonista: idiomatic Python

This article is long but very practical. This article introduces a series of familiar Python usage and skills. Learn how to get the Python code written in this article to the next level and make you a real pythoneer.

3. pep318 decorators for functions and methods

In the world of Python, decorator is very common. For example, auth and cache all provide decorator. The function implemented by decorator is to modify the functions and methods defined after decorator, you can fill in an existing function and method as needed.

4. Python Regular Expression documentation

Mastering regular expressions is a required skill for programmers. This is the official document of the RE module. Regular Expressions are often used for turning over. The usage of Python regular expressions is a little different from that of functions in other languages, so some people complain that the re module of python is not easy to use. The regular expression rules section at the beginning of this article can be used as an entry-level material for regular expressions, if you do not know what a regular expression is. I personally think that python's Re module is very powerful. For example, verbose's regular expression also supports adding comments in the middle of the regular expression to explain the specific meaning of the regular expression, because regular expressions are generally as difficult as tianshu, this function is very useful.

a = re.compile(r"""/d +  # the integral part                   /.    # the decimal point                   /d *  # some fractional digits""", re.X)

5. pep333 Python Web Server Gateway Interface V1.0

If you want to use python for web-related development (mainly for Web applications), wsgi is a must-read standard. wsgi is an official standard between Python web server, application, and middleware, currently, the mainstream Python web server and framework must support wsgi. Only by understanding wsgi can you better understand the working mechanism of the Python web framework, why can the middleware be connected together, and how the Web server interacts with the Web application. Wsgi is criticized in two ways. First, it does not support Asynchronization. Tornado is an asynchronous Web server. However, to run the wsgi framework such as Django, the asynchronous feature of Tornado is completely unavailable; the second is that wsgi V1.0 does not support python3.x. To support python3.x, there are two PEP documents pep3333 and pep444 in the draft State for your reference.

6. How to use Linux epoll with Python

More deeply, If You Want To program on the server side, this article will give you a deep understanding of Python's synchronous and asynchronous socket programming modes. If you think the source code of Tornado is confusing, reading this article will be of great help to you.

7. There are also some important documents which will not be explained here. If you are interested, you can check them out:

  • Python docstring
  • Coroutines via enhanced generators
  • Greenlet documentation
  • Unifying types and classes in Python (to overturn the wall)
  • Python attributes and Methods
  • Python types and objects, Chinese version see: http://wiki.woodpecker.org.cn/moin/PyTypesAndObjects
  • To be added... welcome to your suggestion.

Reprinted from: http://feilong.me/2011/01/recommended-entries-for-you-to-master-python

Related Article

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.