"Writing the code to improve the quality python program of 91 recommendations" 1-5

Recommendation 1: pythonic of readability;

Proposal 2: named code detector having a self-releasing property pep8 proposed standard;

Recommendation 3: Distinction and the C language, although the underlying C language. Dressed in skins of sheep, it must look Ta looks like a wolf!

             (1) "Indent" instead of "{}"

             (2) '' and '' itself is not strictly distinguished

             (3)  X if  statence else Y   代替     statence ? X : Y

             (4)  代替 switch...case... : if ... elif...elif...else...

Recommendation 4: Adding a comment

            Block comments #xxxxxxx

            行注释
            """ Describe xxxxx   Args:  param1: xxx param2:xxx   Return: xxxx

            """

           Documentation Comments: 

            

 

Recommendation 5: appropriately add a blank line, increase readability,
          (1) partial wrapping function block is completed

          (2) function on the caller, callee next

          (3) not more than 80 characters per line, the branch to be aligned

          (4) the rational use of space

  

Guess you like

Origin www.cnblogs.com/alphabetax/p/11948887.html