Coding Standards

2012 年 12 月 27 日4520

User Notes:

Note by: hm2k

Redirected here from the "Add Patch" page with the statement "Make sure your coding style complies with Coding Standards".

I don't see the term "patch" on that page, which specific section should I be looking at?

However, I managed to locate the instructions for submitting a patch here:

http://http://www.zjjv.com///manual/en/contributing.patches.php

Unfortunately I see no Windows support WinMerge or TortoiseSVN.

Note by: Jim

Rules, rules and more rules. I can understand the length. Tabs, on the other hand, pl--ease - I like to see the code without scrolling or wrapping. As long as the tabs are noticeable and well placed, two spaces per tab is ideal = easily read.

Note by: v1d4l0k4@gmail.com

From the PEP 8 -- Style Guide for Python Code about maximum line length:

"Limit all lines to a maximum of 79 characters.

There are still many devices around that are limited to 80 character

lines; plus, limiting windows to 80 characters makes it possible to have

several windows side-by-side. The default wrapping on such devices

disrupts the visual structure of the code, making it more difficult to

understand. Therefore, please limit all lines to a maximum of 79

characters. For flowing long blocks of text (docstrings or comments),

limiting the length to 72 characters is recommended."

IMHO, it's a good choice.

Note by: akronymn

The suggestion on line lengths is only partly due to terminal considerations. Readability of code is also a very important issue. It's not about setting a precise limit for the sake of consistency so much as giving a guideline to make sure that your code is easily readable both by yourself and others who must follow it later.

Note by: SnowDrummer

That's a silly note to add. 75-85 is ~80 characters for that very reason (standard terminal width). If you only go a couple characters over there is no reason to split your code into two lines.

Note by: thomas@apestaart.org

If you're limiting 75-85 chars, why not just limit to 80 chars ? There's no point pissing off the people that still respect the most common terminal width.

0 0