Liaoche Teacher Python Tutorial after reading notes

Source: Internet
Author: User
Tags iterable

Teacher Liao Website: http://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000

Take a few days to see teacher Liao's python tutorial, now Summarize.

(i work with Python 1.5, there is a certain Python foundation, read the "python core programming" and part of the "python source code analysis", only to feel useful to remember)

  • Advanced Features

    1. slices, for list and tuple

    2. Generator yield, used by the co-process, for asynchronous

    3. Iterator iterable (can be used for), where the generator is an Iterator object (which can be used for next), but,, list dict str Although Yes Iterable , it is notIterator

  • Function-type programming

    1. Higher-order functions, One function can receive another function as a parameter, and this function is called the higher order function (map, reduce, filter, sorted ...). )

    2. adorner, dynamically adding functionality during code run, using ' @ Function name '

    3. Partial function, can be created with functools.partial

  • Object-oriented Advanced Programming

    1. __slots__, restricting the properties that a class instance can add, and also reducing the memory that the class instance occupies

    2. @property, The Magic Decorator method

    3. Metaclass Meta class, Customizable class, If you do not know the proof is not used, type () can create a class

  • Commissioning and testing

    1. debug, lowest level print, second assertion (assert), preferably with logging, pdb (pdb.set_trace ()) or similar method

    2. testing, Unit Testing (unittest) and document testing (doctest)

  • processes and threads

    1. multi-process, Less use of os.fork () linux, multiprocessing,process Create process, pool creates process pools, subprocess creates child processes, Queue , pipes interprocess communication

    2. multi-threaded, threading, lock; python interpreter due to the Gil Global lock at Design time, multithreading cannot take advantage of multi-core

    3. ThreadLocal, resolves an issue in which parameters pass between functions in a thread

    4. distributed processes, multiprocessing .managers. basemanager

  • Web Development

    1. HTML is a text that defines a web page, which is used to write Web pages, and HTTP is a protocol for transmitting HTML over a network for browser and server communication

    2. HTML defines the content of the page, CSS to control the style of the page elements, and JavaScript is responsible for the Page's interactive logic

    3. Wsgi:web Server Gateway Interface, interface to receive HTTP requests, resolve HTTP requests, Send HTTP Responses

    4. Web framework, Let's move from WSGI processing function to url+ corresponding processing function, the WSGI abstraction out; Python's Common web Framework is django, tornado, flask

    5. Use template MVC to improve programming efficiency

  • Asynchronous IO

    1. coroutine, High efficiency, No lock mechanism required, python using generator yield implementation

    2. asyncio,Provides complete asynchronous IO support ( async and await, new syntax for coroutine)

    3. aiohttp,asyncioimplementation-based HTTP Framework

Liaoche Teacher Python Tutorial after reading notes

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.