Syntax across languages

Duncan Booth duncan.booth at invalid.invalid
Tue Oct 25 09:46:07 CEST 2005

Tim Roberts wrote:

>>- Nestable Pascal-like comments (useful): (* ... *)
> That's only meaningful in languages with begin-comment AND end-comment
> delimiters.  Python has only begin-comment.  Effectively, you CAN nest
> comments in Python:

I believe that the OP is mistaken. In standard Pascal comments do not nest, 
and you can mix delimiters so, for example:

    (* this is a comment }

Most Pascal implementations require the delimeters to match and allow you 
to nest comments which use different delimiters, but I'm not aware of any 
Pascal implementations which would allow you to nest comments with the same 

    (* This is not a valid (* comment within a comment. *) *)

To this extent Python (if you consider docstrings as a type of comment) 
does exactly the same thing:

""" this is # a docstring! """

# and this is """ a comment """

More information about the Python-list mailing list