> My current understanding of function length best practice is that: 1) > Each function should have preferably ONE clearly defined purpose.
Purpose is the biggest factor for me. > 2) I have seen varying recommendations as to number of lines of code per > function, I don't weight this as heavily. I guess I treat physical metrics mostly like guidelines... except for line length, for arbitrary reasons. :P. Anything that goes longer than 80 characters just makes me uncomfortable. I do like short functions, but if some block of code is a few lines longer than average, that's probably ok. What I'd be looking at more closely is the complexity of the statements *in* the function. "Is the function deeply nested?", for example. Just to add: I find that unit testing has an influence on me that encourages writing shorter functions, mostly because the unit testing forces me to make sure the function's easy to test. Kent Beck's "Test Driven Development by Example" talks about this in more depth. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor