python learning manual notes --15 Document

00. This is related to the concepts and tools, but this topic will be presented here for two reasons, first, it designed a model Python syntax, but it is the key to understand what efforts Python toolset readers of resources.

01.Python preset alarming number of functions: built-in functions and abnormal, object properties and methods, the library of pre-defined module.

02.Python documentation resources
Document # annotation file
dir function object in the list of available properties
Documents __ doc__ attached to the object: The document string
PyDoc: interactive help function object help
PyDoc: HTML report viewer modules document
Description standards Manual formal language and library
website resources online tutorials, examples and other
books published business reference books

03. In fact, the current best practice generally indicates that the document is most suitable for larger string of documents, and document annotation # best for smaller functions.

04.dir function: a simple way to list all the properties available in retrieving objects when the built-in dir function. It can call any object has properties. dir function as a reminder of memory, providing a list of attribute names, but does not tell what the significance of what Ming Chen yes.

 

05. The focus of the agreement is that document, comments are saved in __doc__ properties for viewing (after file import). Therefore, to display the module and its documentation string of the association intended, we just need to import the file, simply print __doc__ property.

06. Priority documents between programs apes are low. Under normal circumstances, if you see the file any comments that have been considered lucky. However, this book is highly recommended that you write the code Detailed documentation is an important part of who actually write the code. The point here is that the current structure of the document there is no standard string.

07. common trap of writing code
* Do not forget the colon
* begins at line 1
* a blank line in interactive mode prompt is very important
* to be consistent indentation
* Do not Python written in C code
* Use simple for loop, and not while or range.
* To pay attention to the object variable assignment statement
* Do not expect the function to modify and then place the object will return results
* Be sure to use parentheses to call functions
* Do not overload the import and use of extension or path

Guess you like

Origin www.cnblogs.com/aixiaoxiaoyu/p/11204900.html