Forums

namespace cannot contain a class with the same name

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

Re: namespace cannot contain a class with the same name

Postby Charles » Sat Oct 23, 2010 6:59 pm

Overall it looks great. No errors stood out to me, but there are some things I would do slightly differently. Instead of what I call "top comments" like:
class A

# A description here on top of a method whose name we haven't read yet.
def foo
pass
...we have an explicit feature for such documentation:
class A

def foo
""" A description here after you read the "def" and the method name. """"
pass
These are called doc-strings and are picked up my the "cobra -doc" option whereas the top comments will be lost.

You can write this code:
i = 0
while i < 10
obj.foo
i += 1

# like this instead:

for i in 10
obj.foo

In the minimal version you can stack up your assignments in one line:
# three lines:
__message = ''
__name = ''
__loopMessage = 0

# one liner:
__message, __name, __loopMessage = '', '', 0

Most everybody puts a blank line before method defs for improved readability.

Most fields are done with underscore, but maybe you wanted 2 for "private" instead of "protected".

I'm doubtful that the "Verbose" version of programs is needed or instructive.

HTH. Thanks again.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Previous

Return to Discussion

Who is online

Users browsing this forum: No registered users and 51 guests