[Python-ideas] "While" suggestion

Terry Reedy tjreedy at udel.edu
Tue Jul 29 11:27:20 CEST 2008



Jacob Rus wrote:
> Andrew Akira Toulouse wrote:

>>     tokenchecks = [token for regex,token in match_tok until 
>> regex.match(s)]     return tokenchecks[-1]

This is missing either ';' or '\n' between the statements.
> 
> This is much more readably expressed as:
> 
> for regexp, token in match_tok:
>     if regexp.match(s):
>         return token

Besides which, creating an unbounded list one does not actually want 
strikes me as conceptually ugly ;-).




More information about the Python-ideas mailing list