Re: What's the word on using to comment-out?

2010-02-26 Thread Michael Rudolf

Am 25.02.2010 17:39, schrieb Grant Edwards:

IMO, any sort of commented out code left in a program is a
big mistake.  If the code is soething that does need to stay
for optional use, then it needs to be properly integrated along
with logic to control when it's used.


OK, then we are perfectly fine and of course for personal use everyone 
can comment out code as they wish.


I'd just hate to see something like if False in production level code.
--
http://mail.python.org/mailman/listinfo/python-list


Re: What's the word on using to comment-out?

2010-02-26 Thread Michael Rudolf

Am 26.02.2010 12:47, schrieb Michael Rudolf:

I'd just hate to see something like if False in production level code.


And yeah, I've seen it. And worse.
--
http://mail.python.org/mailman/listinfo/python-list


Re: What's the word on using to comment-out?

2010-02-25 Thread Paul Rudin
kj no.em...@please.post writes:

 I think I remember, early in my learning of Python, coming across
 the commandment THOU SHALT NOT USE TRIPLE-QUOTES TO COMMENT-OUT
 LINES OF CODE, or something to that effect.  But now I can't find
 it!

No idea, but it would be nice to have some multiline comment syntax
(other than # at the beginning of each line). Particularly one that can
be nested.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What's the word on using to comment-out?

2010-02-25 Thread Tim Chase

Paul Rudin wrote:

kj no.em...@please.post writes:


I think I remember, early in my learning of Python, coming across
the commandment THOU SHALT NOT USE TRIPLE-QUOTES TO COMMENT-OUT
LINES OF CODE, or something to that effect.  But now I can't find
it!


No idea, but it would be nice to have some multiline comment syntax
(other than # at the beginning of each line). Particularly one that can
be nested.


Well, there's always if 0/if False, but that requires 
screwing with the indentation levels.  Granted, any competent 
text editor will allow you to easily shift code indentation (I 
know Vim does, and am pretty sure Emacs will let you do the 
same...YMMV with other editors).


But yes, there have been times that a multi-line commenting that 
doesn't touch your indentation would be nice, and I confess to 
using triple-quotes to do that (opting for  or ''' based on 
the type of triple-quotes found in the code).  However, I usually 
limit this for debugging purposes and they usually get pruned or 
uncommented for production code.


-tkc



--
http://mail.python.org/mailman/listinfo/python-list


Re: What's the word on using to comment-out?

2010-02-25 Thread Lie Ryan
On 02/25/10 05:18, kj wrote:
 I think I remember, early in my learning of Python, coming across
 the commandment THOU SHALT NOT USE TRIPLE-QUOTES TO COMMENT-OUT
 LINES OF CODE, or something to that effect.  But now I can't find
 it!

I've never heard of it, though I can think of a few reasons why TQC
might be a bad thing. Especially if a user pydoc-ed your module and see
a bunch of meaningless code.

 Is my memory playing me a trick?
 
 After all, from what I've seen since then, the practice of
 triple-quote-commenting (or TQC, pardon the TCA) is in fact quite
 common.
 
 Is TQC OK after all?

I'd say it's OK for quick and dirty code, or when you're rewriting a
significant part of the code especially in early development (or you
haven't setup a version control system since it's a damn small script).
They shouldn't be permanent though, due to docstring problem.

 If not, what's the case against it?
 
 Also, has the BDFL expressed an opinion on the subject?  Alternatively,
 is there any other more or less authoritative opinion on TQC? 
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: What's the word on using to comment-out?

2010-02-25 Thread macbeth


 From: Lie Ryan


 On 02/25/10 05:18, kj wrote:
  I think I remember, early in my learning of Python, coming across
  the commandment THOU SHALT NOT USE TRIPLE-QUOTES TO COMMENT-OUT
  LINES OF CODE, or something to that effect.  But now I can't find
  it!

 I've never heard of it, though I can think of a few reasons why TQC
 might be a bad thing. Especially if a user pydoc-ed your module and see
 a bunch of meaningless code.

That is why I was told not to use  to comment code.

Use '#' for code and  for docs

But, I do not remember reading it any where.

I found this ---
http://mail.python.org/pipermail/tutor/2004-February/028432.html





-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What's the word on using to comment-out?

2010-02-25 Thread Grant Edwards
On 2010-02-25, Paul Rudin paul.nos...@rudin.co.uk wrote:
 kj no.em...@please.post writes:

 I think I remember, early in my learning of Python, coming across
 the commandment THOU SHALT NOT USE TRIPLE-QUOTES TO COMMENT-OUT
 LINES OF CODE, or something to that effect.  But now I can't find
 it!

 No idea, but it would be nice to have some multiline comment syntax
 (other than # at the beginning of each line). Particularly one that can
 be nested.

if 0:

Seriously, that's what I generally do: mark the block of code,
indent it 1 level, add an if 0: at the top.

-- 
Grant Edwards   grante Yow! What a COINCIDENCE!
  at   I'm an authorized SNOOTS
   visi.comOF THE STARS dealer!!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What's the word on using to comment-out?

2010-02-25 Thread Michael Rudolf

Am 25.02.2010 16:07, schrieb Grant Edwards:

On 2010-02-25, Paul Rudinpaul.nos...@rudin.co.uk  wrote:

No idea, but it would be nice to have some multiline comment syntax
(other than # at the beginning of each line). Particularly one that can
be nested.


if 0:

Seriously, that's what I generally do: mark the block of code,
indent it 1 level, add an if 0: at the top.



I really hate it when I see something like this in other's code.
The fact that my IDE (vim) still displays this like valid code ready to 
be executed can cause extreme frustration while trying to spot a bug.


This is almost as bad as commenting out (parts of) a for loop by 
adding a continue.


I once saw this in production code and wanted to kill the original 
developer, as commenting out the parts of the code with the continue (it 
was a *bg* for-loop) for debugging purposes actually would have 
*enabled* the code below, thus rendering the whole database useless.


Lucky me that I a) had backups b) set up a sandbox and c) actually saw 
this before it was too late.


Regards,
Michael
--
http://mail.python.org/mailman/listinfo/python-list


Re: What's the word on using to comment-out?

2010-02-25 Thread Grant Edwards
On 2010-02-25, Michael Rudolf spamfres...@ch3ka.de wrote:
 Am 25.02.2010 16:07, schrieb Grant Edwards:
 On 2010-02-25, Paul Rudinpaul.nos...@rudin.co.uk  wrote:
 No idea, but it would be nice to have some multiline comment syntax
 (other than # at the beginning of each line). Particularly one that can
 be nested.

 if 0:

 Seriously, that's what I generally do: mark the block of code,
 indent it 1 level, add an if 0: at the top.

 I really hate it when I see something like this in other's
 code. 

The only time you'll see that in my code is if you're watching
over my shoulder as I troublshoot something.

 The fact that my IDE (vim) still displays this like valid code
 ready to be executed can cause extreme frustration while
 trying to spot a bug.

Nobody in their right mind _leaves_ commented out code like
that (or other commenting mechanisms) in a program after
they're done with whatever little experiment they were
performing.

I know people who will re-write a block of code and leave the
old code there, but comment it out, along with the date and
their name, and other such nonsense.  I hate that. Keeping
track of what _used_ to be there and who changed what when is
the job of the version control system.  Trying to keep the
edit-history of a file in-line as comments just makes the code
hard to read and maintain.

 This is almost as bad as commenting out (parts of) a for
 loop by adding a continue.

IMO, any sort of commented out code left in a program is a
big mistake.  If the code is soething that does need to stay
for optional use, then it needs to be properly integrated along
with logic to control when it's used.

-- 
Grant Edwards   grante Yow! Four thousand
  at   different MAGNATES, MOGULS
   visi.com NABOBS are romping in my
   gothic solarium!!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What's the word on using to comment-out?

2010-02-24 Thread rantingrick
On Feb 24, 12:18 pm, kj no.em...@please.post wrote:
 I think I remember, early in my learning of Python, coming across
 the commandment THOU SHALT NOT USE TRIPLE-QUOTES TO COMMENT-OUT
 LINES OF CODE, or something to that effect.  But now I can't find
 it!

Your going to get many opinions on this subject but my stance is --
use quotes for stings and hash chars for comments -- thats the end of
it for me ;)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What's the word on using to comment-out?

2010-02-24 Thread mk


Get a decent editor, like PyScripter, and press Ctrl-' (toggle comment).

Regards,
mk


--
http://mail.python.org/mailman/listinfo/python-list


Re: What's the word on using to comment-out?

2010-02-24 Thread Aahz
In article hm3qhi$2c...@reader2.panix.com, kj  no.em...@please.post wrote:

I think I remember, early in my learning of Python, coming across the
commandment THOU SHALT NOT USE TRIPLE-QUOTES TO COMMENT-OUT LINES OF
CODE, or something to that effect.  But now I can't find it!

Is my memory playing me a trick?

Possibly.  I certainly do that.
-- 
Aahz (a...@pythoncraft.com)   * http://www.pythoncraft.com/

Many customs in this life persist because they ease friction and promote
productivity as a result of universal agreement, and whether they are
precisely the optimal choices is much less important. --Henry Spencer
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What's the word on using to comment-out?

2010-02-24 Thread CM
 After all, from what I've seen since then, the practice of
 triple-quote-commenting (or TQC, pardon the TCA) is in fact quite
 common.

 Is TQC OK after all?

 If not, what's the case against it?

I have no sense of how approved it is, and don't have a strong opinion
on it, but I would think that some cases against it could be:

- It's used for docstrings, so when you scan code it is harder to
instantly find comment blocks or docstrings if IDE parsers color code
comments differently than docstrings.  An IDE I use (Boa Constructor)
uses # XXX [comment] as a comment that means add to the to-do list
as well.

- If you want to search for comments easily, you can search for #,
which will probably only bring you to comments, whereas if you search
for quote marks, they could be used in a number of different ways in
the code.

- Adhering to coding conventions is a good thing in open source
applications.


-- 
http://mail.python.org/mailman/listinfo/python-list