From: rx on

"Jorge Godoy" <godoy(a)ieee.org> wrote in message
news:1783712.Nhl0uzysWq(a)jupiter.g2ctech...
> rx wrote:
>
>> I don't understand the problem - why should comments (and I hope you
>> believe there should be a one line comment at least) be restricted to one
>> line. It doesn't work that way for if, while, for.
>
> It is the minimum case that can solve a problem commenting one line -- or
> part of it as in "print '3' # print the number 3" -- or commenting
> multiple
> lines. It is also easier to deal with since you don't have to end your
> comment all the time.
>
> For "if", "while", "for", etc. you have ":" and the indentation. You
> don't
> have an "endif", "endwhile", "endfor" (so, why having an "end comment"?).
>
> --
> Jorge Godoy <godoy(a)ieee.org>
>

There no reason why a multiple line comment couldn't be indented (then the
indentation is the end of comment in some sense), but I don't find that
logical - after all its my comment and I don't want python to tell me how to
indent it.


From: Jorge Godoy on
rx wrote:

> Still a little strange to newcomers that there are three ways to do the
> same and that you should be carefull to use the right '''/""" inside the
> comment else the comment will not work for some reason.
>
> #comment
>
> '''
> comment
> '''
>
> """
> comment
> """

Please, note that triple quotes are not for comments. They may be used like
that and they are used like that, but their primary intention is for
multiline strings (something like the here docs in Perl, for example).

Triple quotes can also be used like this:

usage = """
This program accepts the following options:

--help, -h Display this message
--verbose, -v Display more details
"""

This defines a multiline string. If you had to use only single quotes then
you'd have to insert "\n" for each newline.

--
Jorge Godoy <godoy(a)ieee.org>

"Quidquid latine dictum sit, altum sonatur."
- Qualquer coisa dita em latim soa profundo.
- Anything said in Latin sounds smart.
From: OKB (not okblacke) on
Ben Finney wrote:

> Indeed. Using revision control means never needing to comment out
> blocks of code.
>
> If your revision control system is so inconvenient to use that you'd
> rather have large blocks of commented-out code, it's time to start
> using a better RCS -- perhaps a distributed one, so you can commit to
> your own local repository with abandon while trying out changes.

I don't buy this kind of argument. It seems strange to say that
the language is designed a certain way because users are expected to use
certain kinds of third-party tools to manage their code. What if I'm
just putting together a little script to do something and I don't want
to mess with a revision control system?

--
--OKB (not okblacke)
Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is
no path, and leave a trail."
--author unknown
From: Ben Finney on
"OKB (not okblacke)" <brenNOSPAMbarn(a)NObrenSPAMbarn.net> writes:

> Ben Finney wrote:
> > If your revision control system is so inconvenient to use that
> > you'd rather have large blocks of commented-out code, it's time to
> > start using a better RCS -- perhaps a distributed one, so you can
> > commit to your own local repository with abandon while trying out
> > changes.
>
> I don't buy this kind of argument. It seems strange to say
> that the language is designed a certain way because users are
> expected to use certain kinds of third-party tools to manage their
> code.

You're reading a causal relationship where none was asserted.

> What if I'm just putting together a little script to do something
> and I don't want to mess with a revision control system?

If it's so little, why are single-line comments not enough?

If it's large enough that large blocks of code need changing
frequently, I assert revision control is needed.

The barriers to using a good revision control system are so low these
days it's poor practice to avoid using one for anything but throw-away
programs.

--
\ "The illiterate of the future will not be the person who cannot |
`\ read. It will be the person who does not know how to learn." |
_o__) -- Alvin Toffler |
Ben Finney

From: Sion Arrowsmith on
Edward Elliott <nobody(a)127.0.0.1> wrote:
>Sion Arrowsmith wrote:
>> Really? Under what circumstances is it easier to see what's going on
>> with start/end comments than with comment-to-end-of-line?
>Off the top of my head:
> [ ... ]

It appears to me that our fundamental difference is that you see value
in long-term preservation of sections of commented-out code without
any kind of real comment as to what's going on, whereas I consider
this to be appallingly bad practice.

--
\S -- siona(a)chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
___ | "Frankly I have no feelings towards penguins one way or the other"
\X/ | -- Arthur C. Clarke
her nu become? se bera eadward ofdun hl?ddre heafdes b?ce bump bump bump
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9
Prev: how do you pronounce 'tuple'?
Next: A Unicode problem -HELP