79 chars or more?

Stefan Schwarzer sschwarzer at sschwarzer.net
Tue Aug 17 18:21:53 CEST 2010


On 2010-08-17 17:44, AK wrote:
> On 08/17/2010 10:28 AM, Stefan Schwarzer wrote:
>> I'd probably reformat this to
>>
>>            self.expiration_date = translate_date(
>>              find(response, 'MPNExpirationDate').text,
>>              '%Y-%m-%d', '%m%d%Y')
>>
>> or even
>>
>>            self.expiration_date = translate_date(
>>              find(response, 'MPNExpirationDate').text,
>>              '%Y-%m-%d',
>>              '%m%d%Y')
>>
>> for consistency.
>>
>> This not only limits the width but also makes the nesting of
>> the calls more visible.
> 
> Doesn't this create the problem of functions growing too long to fit in
> a screen? I think it's very useful to try to keep function size low
> enough so that you can view the whole function without having to scroll
> up and down. (even though that's not always possible) -ak

I think I'd extract some part of the function into a new
function then. In my opinion, the reasoning is similar to
the case, "Can't I use two spaces per indentation level?
That way I don't run so easily into the right margin if I
have more than five indentations in a function." ;-)

Stefan



More information about the Python-list mailing list