This should be a simple question...

Steven D'Aprano steve at pearwood.info
Fri Mar 6 22:02:20 CET 2009


Tim Chase wrote:

> If the constants don't actually share any conceptual commonality,
> then SteveH is right, that they really should just be globals.

Surely that's backwards? If the constants don't share any conceptual
commonality, they should be kept independent in the functions and not made
global.

k = 2.5

def population(n):
    """Return the total population of n families."""
    return k*n

def calculate_leave(n):
    """Return the number of days of leave after working n days."""
    return n/10*k


-- 
Steven




More information about the Python-list mailing list