Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #53695

Re: how to detect comment in source code file ?

From Piet van Oostrum <piet@vanoostrum.org>
Newsgroups comp.lang.python
Subject Re: how to detect comment in source code file ?
Date 2013-09-05 08:11 -0400
Message-ID <m2vc2fqxh4.fsf@cochabamba.vanoostrum.org> (permalink)
References <1fbab13d-bb98-465e-affe-f2fddeec8138@googlegroups.com> <mailman.70.1378352705.5461.python-list@python.org>

Show all headers | View raw


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

> On Tue, 3 Sep 2013 23:05:57 -0700 (PDT), vnkumbhani@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@vanoostrum.org>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

how to detect comment in source code file ? vnkumbhani@gmail.com - 2013-09-03 23:05 -0700
  Re: how to detect comment in source code file ? Ben Finney <ben+python@benfinney.id.au> - 2013-09-04 17:02 +1000
    Re: how to detect comment in source code file ? Paul Rudin <paul@rudin.co.uk> - 2013-09-04 08:18 +0100
    Re: how to detect comment in source code file ? Steven D'Aprano <steve@pearwood.info> - 2013-09-05 01:56 +0000
  Re: how to detect comment in source code file ? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-09-04 23:40 -0400
    Re: how to detect comment in source code file ? Piet van Oostrum <piet@vanoostrum.org> - 2013-09-05 08:11 -0400
  Re: how to detect comment in source code file ? Vincent Vande Vyvre <vincent.vandevyvre@swing.be> - 2013-09-05 07:33 +0200

csiph-web