Logical lines of code counter

Leif K-Brooks eurleif at ecritters.biz
Mon Aug 23 03:44:17 CEST 2004

I got bored with working on larger projects and wrote a little 
script/module for counting logical (not physical) lines of Python code 
in a file or directory. It uses ASTs generated by compiler.parse instead 
of text manipulation functions, so it isn't incredibly fast, but the 
speed is good enough to be usable for me.

If you want to take a look, the file is at 
<http://ecritters.biz/linecount.py>. I don't really care about how 
people license their modifications (and the GPL is longer than the 
script itself), so it's licensed under the MIT License.

I'm sure there are a few bugs (AST nodes I forgot to count?), and I'd 
appreciate being emailed if anyone finds one.

More information about the Python-list mailing list