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

2013-01-05 Thread Roy Smith
In article , Dave Angel wrote: > On 01/05/2013 10:17 AM, chaouche yacine wrote: > > > > > > > > Here is my implementation : > > > > defcount_loc(lines):nb_lines =0docstring =Falseforline inlines:line > > =line.strip()ifline ==""\ orline.startswith("#")\ ordocstring > > andnot(line.startswit

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

2013-01-05 Thread chaouche yacine
ing or ending docstring     elif line.startswith('"""') or line.startswith("'''"):     docstring = not docstring         continue     else:     nb_lines += 1     return nb_lines - Original Message - From: Chr

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

2013-01-05 Thread Dave Angel
On 01/05/2013 10:17 AM, chaouche yacine wrote: > > > 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.startswi

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

2013-01-05 Thread Chris Angelico
On Sun, Jan 6, 2013 at 2:17 AM, chaouche yacine wrote: > 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("'''

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

2013-01-05 Thread chaouche yacine
ith("'''"):docstring =notdocstring continueelse:nb_lines +=1returnnb_lines - Original Message - From: Chris Angelico To: python-list@python.org Cc: Sent: Saturday, January 5, 2013 3:09 PM Subject: Re: Couting the number of lines of code of a python program On

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

2013-01-05 Thread Chris Angelico
On Sun, Jan 6, 2013 at 12:55 AM, chaouche yacine wrote: > The > problem is that I'm using the inspect module, because it provides a > nice function inspect.getsourcelines that takes a python object and > return its number of lines of code. BUT, it works on live objects, that > means one has to fi

Couting the number of lines of code of a python program

2013-01-05 Thread chaouche yacine
Hello. I'v written a small script that prints the number of lines of code of a python program to stdout (by module, function, class and method), the sources are available online here  https://www.assembla.com/code/tahar/subversion/nodes. The readme has an example usage as well as a trace of