RFC: Assignment as expression (pre-PEP)
darklord@timehorse.com
TimeHorse at gmail.com
Thu Apr 5 18:10:59 EDT 2007
On Apr 5, 6:01 pm, Neil Hodgson <nyamatongwe+thun... at gmail.com> wrote:
> darkl... 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.
>
> Neil
That was a typo. I meant to reuse my_match in the line "capper =
my_match.group(1)" rather than the line above just so I would not have
to evaluate the regular expression twice. Sorry for the confusion.
Jeffrey.
More information about the Python-list
mailing list