On Sat, 31 Oct 2009 20:03:29 -0500, Peng Yu wrote:

>> If it should ever happen that two functions are too long to put in a
>> single file you should refactor your code. It is usually a good idea of
>> breaking problems down into single steps (ie functions) so you never
>> end up with a 5000 SLOC *function*.
> 
> My definition of long is more than one screen.
> 
>> How do functions of this length enhance the readability of your source
>> code?
> 
> If the code is of one screen, you can easily see what it does without
> having to scroll back and forth.

Far enough, but you exchange scrolling back and forth from function to 
function with tabbing through editor tabs from file to file. I don't see 
that this is an advantage.

You also complicate calling functions. Instead of:


def parrot():
    spam()
    ham()
    cheeseshop()


you need:


from spam import spam
from ham import ham
from import cheeseshop

def parrot():
    spam()
    ham()
    cheeseshop()


This is not an advantage!




-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to