473,487 Members | 2,452 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how to comment out a block of code

is there a syntax to comment out a block of code? i.e. like html's <!--
comment -->
or perhaps put a marker so that all lines from there on are ignored?
thanks.

Xah
xa*@xahlee.org
http://xahlee.org/PageTwo_dir/more.html

Jul 18 '05 #1
3 19483
A bit of a hack of course, but you can enclose the code that should be
commented out with ''' and ''' or """ and """ (not sure about the name of
this tripple-quoting)
OTOH, some (or even most if not all) Python editors support blockquoting
by pushing a button or using shortcuts. SPE and IDLE for example.

Jul 18 '05 #2
Xah Lee wrote:

is there a syntax to comment out a block of code? i.e. like html's <!--
comment -->
or perhaps put a marker so that all lines from there on are ignored?
thanks.


The simplest way is to select the block of code in your editor and use the
'comment-region' command. If this doesn't work, upgrade your editor.

Most editors have a command to do this although obviously the name will
vary slightly: Idle calls it 'Comment Out Region', SciTe calls it 'Block
Comment', emacs calls it 'comment-region'.
Jul 18 '05 #3
Xah Lee wrote:
is there a syntax to comment out a block of code? i.e. like html's <!--
comment -->
or perhaps put a marker so that all lines from there on are ignored?
thanks.


Of course -- this feature is so important that all computer
manufacturers worldwide have made a special button on the computer
case just for this!

Normally it's a large round button, with perhaps a green backlight.
Press the button and hold it in for about 3 seconds, and the rest of
your code/writing will be ignored just as it should be.

Jeff Shannon
Technician/Programmer
Credit International

Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
18780
by: Rob | last post by:
Hello all, If I have the following code fragment: /* comment bla bla */ ....code... With a regular expression, how do I get/extract the comment inside this multi line comment block. With...
4
5436
by: Matthew Louden | last post by:
I want to know what's the convenient way to comment out a block in ASP pages? I read a book, and I thought we can use /** */ to comment out the VBScript in ASP page, but it yields run time error. ...
1
1629
by: David Veeneman | last post by:
In VS.NET 1.1, when I commented-out a block of code, VS.NET put the comment slashes on the left margin, rather than next to the code. This made it very easy to identify blocks of code that I had...
19
2187
by: diffuser78 | last post by:
Like in C we comment like /* Bunch of lines of code */ Should we use docstring """ """ Or there is something else too ?? Every help is appreciated.
6
2407
by: cdrsir | last post by:
we can use 1) // my comments a 2) /* my comments b */ when we want to add some comments. I know some compilers just support the 2nd syntax, but normally both of these 2 syntaxs are supported...
29
2314
by: dbhbarton | last post by:
Had a thought that's grown on me. No idea if it's original or not- too inexperienced in programming- but I guess there's no harm floating it out there. Python wins big on readability, and...
14
3048
by: Siv | last post by:
Hi, Just busily coding away and removed a procedure from my code and all of a sudden an error came up miles away from the location of the piece of code I removed and it relates to the XML...
39
2838
by: polas | last post by:
Afternoon all. I was just wondering about this point - I have (generally) used // for commenting a single line in C, but from looking at code other people have written it seems many use /* */...
3
10813
by: Richard | last post by:
Again, new to DB2. Trying to do something I can do in Sybase ASE. In any Sybase SQL script I can use /* */ to comment out a block of code. In the DB2 9.0 SQL Reference Manual V1 it says: ...
0
7106
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6967
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7137
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7349
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1381
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
600
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
267
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.