Duncan Booth a écrit :
> [EMAIL PROTECTED] wrote:
> 
> 
>>Performing a list of mutually exclusive checks that require data
>>processing can cause excessive tabification.  For example, consider
>>the following python snipet...
>>
>>temp = my_re1.match(exp)
>>if temp:
>>  # do something with temp
>>else:
>>  temp = my_re2.match(exp)
>>  if temp:
>>    # do something with temp
>>  else:
>>    temp = my_re3.match(exp)
>>    if temp:
>>      # do something with temp
>>    else:
>>      temp = my_re4.match(exp)
>>
> 
> 
> Can you come up with a real example where this happens and which cannot be 
> easily rewritten to provide better, clearer code without the indentation?
> 
> I'll admit to having occasionally had code not entirely dissimilar to this 
> when first written, but I don't believe it has ever survived more than a 
> few minutes before being refactored into a cleaner form. I would claim that 
> it is a good thing that Python makes it obvious that code like this should 
> be refactored.

+2 QOTW
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to