[Yum] I'm back and future stuff
Vladimir Bormotov
bor at vb.dn.ua
Thu Jun 27 18:41:56 UTC 2002
Hi!
SV> I think I will tend to agree with linus, big patches suck. Can you
SV> isolate what they are patching? ie: a reget patch, a tabbing patch, a
SV> doc patch etc etc.
You can help to minimize patches.
just read
http://www.python.org/doc/essays/styleguide.html
http://www.python.org/peps/pep-0008.html
and aplly style recomendation to source code as rules ;)
brief "python-styling":
Indentation
4 spaces for one level.
for example, look at yum-0.8.9/lilo.py, class LiloConfigFile.
cass declaration at first posotion. Nice.
def __repr__ - indented with 4 spaces. Very nice.
s = "" indented with one tab character. Ooops!!!!
look below, into def needsEnterpriseKernel:
for l in f.readlines() indented with 4 spaces, but body indented with
tab character. ;-/
=== styleguide cut ===
Tabs or Spaces?
Never mix tabs and spaces. The most popular way of indenting Python is
with spaces only.
===
Please, NO TAB CHAR IN PYTHON CODE!
Maximum Line Length
Guido say: "please limit all lines to a maximum of 79 characters".
PEP-8 say: "limiting the length to 72 characters is recommended"
Whitespace in Expressions and Statements
NO spaces:
* Immediately inside parentheses, brackets or braces
* Immediately before a comma, semicolon, or colon
* Immediately before the open parenthesis
* More than one space around an assignment operator
* around the '=' sign when used to indicate a keyword argument or a
default parameter value
Always put spases:
* surround these binary operators with a single space on either side:
assignment, comparisons, Booleans
In our code we always use one space after comma. No trailing
whitespeces.
Comments
starts with a # and a single space (unless it is indented text inside
the comment)
--
Bor.
More information about the Yum
mailing list