code critique requested - just 60 lines

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri Oct 3 04:33:32 EDT 2008


En Fri, 03 Oct 2008 05:07:41 -0300, Terrence Brannon <metaperl at gmail.com>  
escribió:

> On Oct 2, 11:56 am, bearophileH... at lycos.com wrote:
>> Terrence Brannon, I suggest you to shorten a lot some of those very
>> long lines.
>
> yes, I wanted to, but was not sure how to continue a line on the next
> line in Python.

Having ANY open () or [] or {} is enough to implicitely continue a line  
(being it a function call, a list definition, a generator expression,  
whatever...)

tags = { 'S':  'Small',
          'M':  'Medium',
          'L':  'Large',
          'XL': 'Extra large',
        }

Also, you may use \ as the LAST character (immediately preceding the  
newline) to continue the logical line on the next physical line:

result = coef[0] * sum_deliverd + \
          coef[1] * max_income + \
          coef[2] * min_delay

-- 
Gabriel Genellina




More information about the Python-list mailing list