In article <mailman.5080.1327510460.27778.python-l...@python.org>, Dennis Lee Bieber <wlfr...@ix.netcom.com> wrote:
> The old convention I'd learned was to keep functions down to a > (printer) page (classical 6 lines per inch, 11" high, tractor feed -- so > about 60 lines per function -- possibly extend to a second page if > really needed. The generalization of that is "keep a function small enough that you can see it all at once". In the days of line printers and green-bar, that meant about 60 lines. As we moved to glass ttys, that started to mean 24 lines. These days, with most people having large high-res monitors, the acceptable limit (by that standard) is growing again. I can easily get 60 lines on my laptop screen. On the other hand, back in the neolithic age, when line printers and mainframes roamed the world, function calls were expensive. People were encouraged to write larger functions to avoid function calls. Now, function calls are cheap. Both because optimizing compilers and better hardware support have made them cheap, and because hardware in general has gotten so fast nobody cares about it anymore (nor should they). So, I'd say the driving principle should be that a function should do one thing. Every function should have an elevator talk. You should be able to get on an elevator with a function and when you ask it, "So, what do you do?", it should be able to explain itself before you get to, "Sorry, that's my floor". If it takes longer than that to explain, then it's probably several functions fighting to get out. -- http://mail.python.org/mailman/listinfo/python-list