Python-- advantages and disadvantages / Code Code / operator / book recommendations

Python's strengths and weaknesses

Python's advantages are many, simple can be summarized as follows.

  • Simple and clear, do one thing only one way.
  • Low learning curve compared with many other languages, Python is easier to use.
  • Open source, has a strong community and ecosystem.
  • Interpreted language, inherently platform portability.
  • It supports two mainstream programming paradigm (object-oriented programming and functional programming) have provided support.
  • Scalability and embeddable can be called C / C ++ code can also call Python in C / C ++ in.
  • High degree of standardized codes, readable, there are codes for obsessive compulsive disorder and crowd.

Python shortcomings mainly in the following points.

  • Slightly lower efficiency and therefore computationally intensive tasks can be written in C / C ++.
  • Code can not be encrypted, but now many companies do not sell software sales but sales service, the issue will be diluted.
  • Too many in the development framework that can be selected (such as Web framework there are more than 100), have a choice where there is an error.

Python code Code

  • Variables, functions and properties should use lower case letters for spelling, if there is more than one word on the use of an underscore to connect.

  • Class by instance property protection should begin with an underscore.

  • Class private instance attribute, it should start with two underscores.

  • Class and unusual name, should capitalize the first letter of each word.

  • Module-level constants, should be in all caps, if there is more than one word to connect with an underscore.

  • Examples of the class method, the first parameter to be designated to represent the object itself self.

  • Class method, you should first parameter to represent the class named cls itself.

  • Using inline forms of negative words, and not to turn negative words in front of the whole expression. For example, if a is not b it is much easier to understand than if not a is b.

  • Do not check the length of the way to determine whether a string, as the list elements or without None, if such wording should not x to check it.

  • Even if the branch, for circulation, except exception caught only one line of code, etc., do not want to code and if, for, except, etc. together to write, write separately only to make the code clearer.

  • Always place the import statement on the beginning of the file.

  • Introduction module when, from math import sqrt math better than import.

  • If there are multiple import statements, it should be divided into three parts, top to bottom are Python standard modules, third-party modules and custom modules, each inner part should be arranged in alphabetical order of the name of the module.


Operators

Here Insert Picture Description


Ary

Binary (e.g. 0b100, is converted to decimal 4), octal (e.g. 0o100, is converted to decimal 64), decimal (100) and hexadecimal (0x100, 256 are converted to decimal)


Recommended books

  • Primer

"Python based tutorial" (Beginning Python the From Novice to Professional)
"Python study manual" (Learning Python)
"Python Programming" (Programming Python)
"Python Cookbook"
"Python Programming" (Python Programming: An Introduction to Computer
Science) " Modern Python Cookbook "

  • Further Reading

"Core Python programming" (the Applications Programming Python Core)
"smooth Python" (the Fluent Python)
"as Effective Python: an effective method for the preparation of high quality 59 Python code" (as Effective Python 59 Specific Ways of Better Python to the Write)
"Design Patterns Python "(Learning Python Design Patterns)
" advanced Python programming "(Expert Python programming)
" performance analysis and optimization Python "(Mastering Python High performance)

  • Web framework

"Django Basic Course" (Tango with Django)
"lightweight Django" (Lightweight Django)
"Python Web Development: Test driving method" (the Test-Driven Development with Python)
"Web Development with Django Cookbook"
"with the Test-Driven Development Django "
" Django Project Blueprints "
" the Flask Web development: Python-based Web application development actual combat "(the Flask Web development: developing Web applications with Python)
" in-depth understanding Flask "(Mastering Flask)

  • Reptile Development

"Written in Python web crawler" (Web Scraping with Python)
"proficient Python Reptile framework Scrapy" (Learning Scrapy)
"Python Network Data Collection" (Web Scraping with Python)
"Python reptiles development and project combat,"
"Python 3 Web crawler Development Operational "

  • data analysis

"Analyzed using Python Data" (Python for the Data the Analysis)
"Python Data Science Handbook" (Python the Data Science Handbook)
"Python Great Financial Data Analysis" (Python for Finance)
"Python data visualization programming combat" (Python Data Visualization Cookbook)
"Python data processing" (data Wrangling with Python)

  • Machine Learning

"Python machine learning Basic Course" (Introduction to Machine Learning with Python)
"Python Machine Learning Practice Guidelines" (Python Machine Learning Blueprints)
"Python Machine Learning Case Studies"
"Python machine learning practice: development methodology test-driven" (Thoughtful Machine A Python with the Test Driven learning Approach)
"machine learning Python classic example" (machine learning Python Cookbook)
"TensorFlow: Google real deep learning framework"

Guess you like

Origin blog.csdn.net/qq_40061206/article/details/94227269