if expression source format

Lambert, David W (S&T) LambertDW at Corning.com
Thu Dec 11 02:07:54 EST 2008


The "if" expression leads to long statements.  Please offer suggestions
to beautify this function.  For this example use maximum line length
marked by the ####'s.

Thank you.


##############################################################
def compute_wind_chill_temperture(T:'Temperature, dF',s:'Wind speed,
mph')->'dF':
    '''
        <http://www.erh.noaa.gov/er/iln/tables.htm#heat index>
    '''
    return 35.74 + 0.6215*T + s**0.16*(T*0.4275-35.75) if T < 40 else T



More information about the Python-list mailing list