As a standard program ape, writing documentation for the program is an essential task, how to write a good and fast, we will discuss the following in detail.
Today will tell you a simple ordinary attention to the small details, you can easily generate the annotation document, you can also check our written class method reference name is repeated problems.
A look at other people's professional Daniel writing documents more cattle envy, don't worry, we can get Python to generate the basic content of the description document, which can improve the overall code reading, and secondly can be the overall structure of the code to look also clearer, so in the handover time can save a lot of trouble, Other colleagues in the process of taking your job will not be a line to ask you what this is what it is, because the annotation has been very intuitive statement, in the integration of the time when the description of the document to the customer simple description (mainly for your boss to see).
So get to the point how to implement look at my simple code format, note that the place and function name class names are associated with the __all__
Introduction to a quick way to generate annotations in a document, first we use the __all__ attribute
Using all classes, functions, variable members, and so on in py for export __all__
Naming conflicts when a module uses the __all__ property to avoid referencing each other
__all__=[' Login ', ' Check ', ' Shop ', ' Updateit ', ' findit ', ' DeleteIt ', ' Createit '
Test comment One can write the function description of this class, etc.
For example, this method is used to write logins
Initialize the parameter description you want
Then the login may be used
Negotiate the feature description you want to implement
Features also have a lot of examples such as validation
Judging statements, verification codes, and the like.
Attributes and methods contained in commodity classes
The price, date, classification, etc. of the initial commodity
Used to update product information
Delete Expired Shelf goods information
Create new product and shelves information
|
Let's emphasize that the name of PY is the same as the PY name of your current job (the name of the py I created here is Pythonzhushi, which is the last name to import), because the import in the following test is itself, so im port name and help (name) and the name of your file should be consistent. For more intuitive look at the following figure:
Of course, you can also import from other file references here use Python's common import method from which directory import imports what files Pythonzhushi
Of course I still use pictures to show the following:
is not at a glance, this can also import the annotation document we need to do, the Help method is to help us to see the file contained in the class, function, a simple help document, similar to the Readme document a description. Finally, let's look at the masking effect:
Is it simple to print out our program documentation, the following steps can be directly built a text to paste the past, the completion of a Readme document description, after testing a few points of attention is, want to write # This note should not be written to the Def release to write to its top position and the adorner similar to the opposite three quotes ' ' Do not write to def outside, this also does not show the effect. Let's go and have a try. Thanks for watching.