[Tutor] Multi-line statements with comments

Jim Angstadt jimajima9@yahoo.com
Sat, 29 Dec 2001 11:53:12 -0800 (PST)


Many thanks for all who responded to my question on
multi-line statements with comments.

Here's a summary of what I learned:

* pure string literal => use triple quotes.

If there are no operators or variables, just pure
text, then I'll use triple quotes.  I have not found
the need to comment my own comments.

* embedded operators and variables => use something
like the following:

# -----
print (                  # let's get busy
  # comments
  'noise %s noise %s noise\n' # base format
  # comments
  'pure text' operators variables \
   more operators, vars, string, etc \
   and the end of statement.
  # comments
  % ( x, y )      # rest of expression
  # comments
)
# -----

In other words, I'll use continuation characters to
keep my lines short, for readability.  Then comment
before and or after.

* functions to remove comments => not yet.

I tend to want to write code that is well-commented
and easy to read, with a minimum of abstraction.  For
now, another function seems a little to much, an
unnecessary amount of logic that others may not pick
up on.

It also may make my code harder to share, without some
cut and paste for readability.

Once again, I appreciate all the responses, thanks
very much.

---
Jim



__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com