Code style
SPQR :: Programming
Page 1 of 1
Code style
This is the current code style for SPQR. I'm not going to defend it here (I think it's good, you may disagree), but feel free to add comments.
Functions are written as verbs doSomethingNow
Variables are written as nouns this_is_my_data
Function docstrings are NOT optional.
It is better, in general, to over-comment rather than under-comment. Comments should tell you WHY, since the code tells you HOW.
However, too much commenting is a sign that something is wrong.
That's all for now folks
- Code:
class CClassname(object):
def __init__(self, some_argument):
"""A very simple function definition,
Written over more than one line"""
self.some_variable = some_argument
# comment - did I mention we use tabs?
a = 5 + 3
if some_test:
doSome(code)
def someFunction(self, more_data_like_this):
return what_you_need
Functions are written as verbs doSomethingNow
Variables are written as nouns this_is_my_data
Function docstrings are NOT optional.
It is better, in general, to over-comment rather than under-comment. Comments should tell you WHY, since the code tells you HOW.
However, too much commenting is a sign that something is wrong.
That's all for now folks
Last edited by maximinus on Sat Jan 01, 2011 9:44 pm; edited 1 time in total (Reason for editing : Changed specs 1/1/11)
Re: Code style
I have amended this to something a lot closer to PEP-8, as you can see from above. I figured that the code last week was about 9200 lines, now it's back down to about 5500 so now was the best time to get to work and change the style. Most of the main classes are done, but it'll still take a week or so till I'm completely done
Re: Code style
Haha
A few spare hours at work and fast keyboard speeds: the whole codebase is now at this new standard
A few spare hours at work and fast keyboard speeds: the whole codebase is now at this new standard
SPQR :: Programming
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|