3 ms·
I prefer the other one, because then I don't have to consider whether there is an outer variable 'x' that is being clobbered.
by im3w1l 10y 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.
- Singletoned 10y agoMost 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).
- aidos 10y agoIn python 3, x is locally scoped to the comprehension :-)