how to detect comment in source code file ?

Piet van Oostrum piet at vanoostrum.org
Thu Sep 5 08:11:51 EDT 2013


Dennis Lee Bieber <wlfraed at ix.netcom.com> writes:

> On Tue, 3 Sep 2013 23:05:57 -0700 (PDT), vnkumbhani at gmail.com declaimed the
> following:
>
>>how works python interpreter for finding comment ?
>>if possible find nested comment ?
>
> 	Python does not have "nested comment". Comments begin at any #
> character that is not inside a string (something inside ' or " pairs).

You could consider this a kind of nested comment :)

# if condition:
#     # calculate the amount
#     amount = sum(parts)
-- 
Piet van Oostrum <piet at vanoostrum.org>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]



More information about the Python-list mailing list