I have a directory with many subdirectories with Python source code which correspond to a Python package. I want to count how many classes and root classes (top of hierarchies) are contained in these directories/package. Any easy way to do this?
Asked
Active
Viewed 564 times
2
-
2See http://stackoverflow.com/questions/1796180/python-get-list-of-all-classes-within-current-module – amit kumar Sep 17 '11 at 08:28
1 Answers
1
You don't need to write a Python script for that. From the command line type:
grep -c "^class " *.py
and will return the number of classes in the current directory for each .py file. To find if a class is a top class I'm afraid you will have to import each and query each module.

Hernán
- 1,749
- 10
- 12