why no block comments in Python?

Terry Hancock hancock at anansispaceworks.com
Fri Mar 10 01:02:27 CET 2006


On 9 Mar 2006 07:21:00 -0800
"msoulier" <msoulier at gmail.com> wrote:
> > (and if you don't, you can quickly comment out regions
> > by putting them inside a triple-quoted string.)
> 
> Although that will use up memory, as opposed to a comment.

Not really. Unless it is the first string in the block
(class, function, module), it won't be assigned to anything,
and will be immediately garbage-collected.

It may consume space in the pyc file, I'm not sure.

Of course, I don't think anyone would advocate leaving
such things in production code where the memory use
would be an issue anyway. The whole point of
block-commenting code out is to temporarily "delete" it
without having to use your version control system to get
it back. You only do that when you have strong feeling
you're going to need to put it back in.

-- 
Terry Hancock (hancock at AnansiSpaceworks.com)
Anansi Spaceworks http://www.AnansiSpaceworks.com




More information about the Python-list mailing list