RFC: Assignment as expression (pre-PEP)

Neil Hodgson nyamatongwe+thunder at gmail.com
Fri Apr 6 00:01:31 CEST 2007

darklord at timehorse.com:

>         else:
>             my_match = capper_re.match(f):
>             if my_match:
>                 capper = capper_re.match(f).group(1)
>                 if capper == 'JJ' or capper == 'JeffreyJacobs':
>                     capper = 'Jeffrey C. Jacobs'
>                 past_title = True

    The assignment to my_match here is not used, so the test can be "if 
capper_re.match(f)" which can then merge up into the previous else as an 
elif dropping one level of indentation.


More information about the Python-list mailing list