Hacker News new | ask | show | jobs
by im3w1l 3393 days ago
I prefer the other one, because then I don't have to consider whether there is an outer variable 'x' that is being clobbered.
2 comments

In python 3, x is locally scoped to the comprehension :-)
Most linters would have suggested correcting it to:

validated_items = [_ for _ in items if is_validated(x)]

where _ is used as a safe variable that can always be clobbered. (Though this does also clash with its use as a gettext function for strings).