How does one consider the change to the PythonPEP8 style in May 3, 2016?

Source: Internet
Author: User
On February 8, May 3, 2016, PEP8 released a version update: PEP8 -- StyleGuideforPythonCode. During code check, colleagues found that the if condition previously written was incorrectly styled, the reason is that and is placed at the beginning of the branch. In the new PEP8 standard, we recommend that you put and at the end of a line for clearer line breaks, however, the relationship between the statements should be clearer in the front. What do you think about the position of and in the if condition and the update? In May 3, 2016, PEP8 released a version update: PEP 8 -- Style Guide for Python Code When checking the code, colleagues found that the if condition previously written was in bad style because and was placed at the beginning of the branch, in the new PEP8 specification, we recommend that you put and at the end of a line for a clearer line feed, but the relationship between statements should be clearer before it, what do you think about the position of and in the if condition and the update? Reply: PEP 8 released a version update on April 8, April 15, 2016. It changed the previously defined "linefeed should be placed after the binary operator" to "linefeed is recommended to be placed before the binary operator 」.

After reading The updated information, it seems that someone has dug up The book "The TeXbook" by Uncle Donald Knuth ", then we found that in the Displayed Equation chapter in the book, Knuth indicates that the formula should put the line break before the binary or relational operator in the case of multiple rows:

The reason for doing so seems to be more readable, such as the example given in PEP 8:

Income = (gross_wages + taxable_interest + (pidends-qualified_pidends)-ira_deduction-student_loan_interest)
With pycharm, there is no wavy line, and it looks comfortable... Original PEP style + 1
Get rid of Python and take jujube pills + 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.