Python's Static grammar check
Python is a dynamic language. There is no strict type restriction when passing parameters to Python.
When writing a Python program, it is often found that errors can only be found at execution time. There are some errors due to hidden deep, only the specific logic will trigger, often resulting in the need to spend a lot of time to get the syntax errors to slowly troubleshoot. In fact, there are some errors are very obvious, if you can write a program to find these errors, you can improve work efficiency. Recently I found that you can use the Pyflakes program to check the syntax of the python syntax so that you can find errors as early as possible.
There are three ways to use Pyflakes, the first is to use as a command line tool, the second can be used as a vim plugin in the Vim editor to achieve WYSIWYG, and the third can be used in Emacs.
Pyflakes:
Cd/usr/src
wget https://pypi.python.org/packages/5b/b7/dcd6ebc826065ca4ccd2406aac4378e1df6eb91124625d45d520219932a1/ PYFLAKES-1.5.0.TAR.GZ#MD5=84A99F05E5409F8196325DDA3F5A1B9A
Tar XF pyflakes-1.5.0.tar.gz
Installation:
CD pyflakes-1.5.0/
Python setup.py Install
Setting up environment variables
Ln-sv/usr/local/python2.7/bin/pyflakes/usr/bin/pyflakes
Grammar check:
#pyflakes nslookup.py
Resources:
Http://www.cnblogs.com/berlin-sun/p/pyflakes.html
Https://pypi.python.org/pypi/pyflakes
This article is from the "Boyhack" blog, make sure to keep this source http://461205160.blog.51cto.com/274918/1942474
Python Learning Note 02