[Python-ideas] "While" suggestion

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Jul 10 01:59:26 CEST 2008


Andrew Toulouse wrote:

> tokenchecks = [token for regex,token in match_tok until regex.match(s)]
> # do whatever from this point forward.
>     return tokenchecks[-1]

This is an abuse of list comprehensions, since
you're throwing away the produced list and only
keeping the last element.

-- 
Greg



More information about the Python-ideas mailing list