gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gzz-commits] gzz/doc/pegboard/coding_standard--vegai peg.rst


From: Benja Fallenstein
Subject: Re: [Gzz-commits] gzz/doc/pegboard/coding_standard--vegai peg.rst
Date: Mon, 13 Jan 2003 14:06:21 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021226 Debian/1.2.1-9

Vesa Kaihlavirta wrote:
    - java imports
    - gzz imports

I'd prefer first gzz, then java, for consistency with Java files and because this makes those imports rest in alphabetical order. (Hmm, come to think of it, I would like to have that rule included: In each group, imports should be in alphabetical order.)

+6. Code should be structured so that it can be imported and re-used, for 
example by
+   putting state in classes instead of the module namespace. Executable code
+   in module namespace is discouraged -- except for "if __name__=='__main__':"

Agree.

+7. Prefer list comprehensions to iterations, especially when dealing with 
lists.

This isn't really clear to me. :-) List comprehensions should be used iff they make the code easier to read and understand. The following is very much not good:

    [java.lang.System.out.println(el) for el in list]

though it will correctly print out each element in 'list.'

Also, what does 'especially when dealing with lists' mean? When else? (Or is that just a joke :-) )

+8. Class names are CapitalizedWords.
+
+9. Class methods and attributes are mixedCase.
+
+10. Functions are lower_case_with_underscores, variables are lowercase.

I don't like this-- I think that for consistency, these should be mixedCase too. They are closest in function to Java's static attributes and methods, which are also mixedCase.

+11. Tab-size is 8 (will be conveted to spaces by make committable), indentation
+    at 4 spaces.

s/conveted/converted/

+- "A Foolish Consistency is the Hobgoblin of Little Minds" - Guido van Rossum

Google it-- it seems to be generally attributed to Ralph Waldo Emerson ("early American essayist and preacher," according to http://www.bookmasters.com/marktplc/00755.htm).

- Benja





reply via email to

[Prev in Thread] Current Thread [Next in Thread]