In article <507170e9$0$29978$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote:
> I've just looked at one of my classes, picked randomly, and the largest > method is twelve lines, the second largest is eight, and the average is > three lines. I took a look at a subtree of the project I'm working on now. 116 python files, 20 kloc, 330 functions (mostly class methods). I did a quick-and-dirty "grep -n" job on them to find the line numbers of the def statements, then another quick-and-dirty python script to find the differences, and summarize. Results below (second column is length of 'def' block in lines, first column is number of blocks of that length). This is just dumb line counting; no attempt to exclude block comments, white space, docstrings, etc. There's three different authors represented here, but I'd guess 70% of the code is mine. Of the three, I'm probably the one who writes the most refactored code (i.e. smallest functions). I just went and found the longest of these (193 lines). It starts with a 95 line block comment. Of the 100-or so lines of real code, I suppose with some effort it could have been refactored some, but not hugely. 7 3 19 4 12 5 17 6 10 7 16 8 10 9 6 10 8 11 11 12 4 13 8 14 9 15 13 16 4 17 8 18 9 19 5 20 9 21 3 22 6 23 5 24 4 25 4 26 4 27 3 28 2 29 1 30 3 31 4 32 4 33 8 34 2 35 2 36 3 37 2 39 1 40 3 41 1 42 3 43 2 44 2 45 1 46 2 47 1 48 1 51 2 54 1 55 2 56 2 59 1 60 1 62 1 63 1 64 1 65 1 74 1 75 1 78 1 94 1 100 1 105 1 148 1 164 1 193 -- http://mail.python.org/mailman/listinfo/python-list