Re: Python syntax in Lisp and Scheme

From: A.M. Kuchling (amk_at_amk.ca)
Date: 10/07/03


Date: Tue, 07 Oct 2003 06:48:45 -0500

On 07 Oct 2003 12:10:28 +0100,
        Ingvar Mattsson <ingvar@cathouse.bofh.se> wrote:
> [1] I naively (but I only use Python (the language) as a Better Perl)
> that all I need to do to comment out a section of code is to smack
> in comment-to-end-of-line as teh first character. Obviously, this
> breaks Python code quite badly.

That should work fine, e.g.

amk@vail:~$ cat t.py

for i in [1,2,3]:
        # Strangely indented comment
    print i
# print i*2
   # More freaky comments
# Comment no. 3
               
amk@vail:~$ python t.py
1
2
3
amk@vail:~$

Comments aren't part of the parser's token stream and are simply discarded,
so their indentation level doesn't matter.

--amk