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


Groups > comp.lang.python > #36182 > unrolled thread

Re: Couting the number of lines of code of a python program

Started byDave Angel <d@davea.name>
First post2013-01-05 10:37 -0500
Last post2013-01-05 10:40 -0500
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Couting the number of lines of code of a python program Dave Angel <d@davea.name> - 2013-01-05 10:37 -0500
    Re: Couting the number of lines of code of a python program Roy Smith <roy@panix.com> - 2013-01-05 10:40 -0500

#36182 — Re: Couting the number of lines of code of a python program

FromDave Angel <d@davea.name>
Date2013-01-05 10:37 -0500
SubjectRe: Couting the number of lines of code of a python program
Message-ID<mailman.124.1357400292.2939.python-list@python.org>
On 01/05/2013 10:17 AM, chaouche yacine wrote:
> <snip>


>
> Here is my implementation :
>
> defcount_loc(lines):nb_lines =0docstring =Falseforline inlines:line =line.strip()ifline ==""\ orline.startswith("#")\ ordocstring andnot(line.startswith('"""')orline.startswith("'''"))\ or(line.startswith("'''")andline.endswith("'''")andlen(line)>3)\ or(line.startswith('"""')andline.endswith('"""')andlen(line)>3):continue# this is either a starting or ending docstringelifline.startswith('"""')orline.startswith("'''"):docstring =notdocstring continueelse:nb_lines +=1returnnb_lines

Wow, this is thoroughly garbled.  Please configure your email (yahoo?)
to use text mode email, to not delete spaces, to honor newlines, etc.


>
>
> ----- Original Message -----
> From: Chris Angelico <rosuav@gmail.com>
> To: python-list@python.org
Why is the quoted part *after* your message?   Please don't top-post on
this list (or most of them).  It gets too garbled after one or two
generations.



-- 

DaveA

[toc] | [next] | [standalone]


#36184

FromRoy Smith <roy@panix.com>
Date2013-01-05 10:40 -0500
Message-ID<roy-792A6A.10404205012013@news.panix.com>
In reply to#36182
In article <mailman.124.1357400292.2939.python-list@python.org>,
 Dave Angel <d@davea.name> wrote:

> On 01/05/2013 10:17 AM, chaouche yacine wrote:
> > <snip>
> 
> 
> >
> > Here is my implementation :
> >
> > defcount_loc(lines):nb_lines =0docstring =Falseforline inlines:line 
> > =line.strip()ifline ==""\ orline.startswith("#")\ ordocstring 
> > andnot(line.startswith('"""')orline.startswith("'''"))\ 
> > or(line.startswith("'''")andline.endswith("'''")andlen(line)>3)\ 
> > or(line.startswith('"""')andline.endswith('"""')andlen(line)>3):continue# 
> > this is either a starting or ending 
> > docstringelifline.startswith('"""')orline.startswith("'''"):docstring 
> > =notdocstring continueelse:nb_lines +=1returnnb_lines
> 
> Wow, this is thoroughly garbled.  Please configure your email (yahoo?)
> to use text mode email, to not delete spaces, to honor newlines, etc.

Nice to know that wasn't just another case of my using an antiquated 
news reader :-)

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web