Pep-8

All

Program in pep8 not in python. That’s a lesson I’ve recently learned.

First of pep8 is the a standard for writing python code [1], it is actually very useful and used. But my review here it is just to pinpoint that for me it was learning a new thing. I might actually say that learning python was a new thing, after learning c/c++/java but learning pep8 is the next step.

Examples:

# Aligned with opening delimiter.
foo = long_function_name(var_one, var_two,
                         var_three, var_four)

My highlights, several standards are really useful but it took me time to learn it. The import rules sometimes it’s annoy though, if you have several importings in different lines. !:

They follow Donal Knuth suggestion for operator simplification! hehe! DK hehe:

income = (gross_wages
          + taxable_interest
          + (dividends - qualified_dividends)
          - ira_deduction
          - student_loan_interest)

Yes, use python, yes use pep8. It might be annoying in the begin but it worth.

[1] https://www.python.org/dev/peps/pep-0008/

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s