Is this a "gotcha" in Python?
Chris Angelico
rosuav at gmail.com
Mon Apr 22 17:36:09 EDT 2019
On Tue, Apr 23, 2019 at 7:28 AM Skip Montanaro <skip.montanaro at gmail.com> wrote:
>
> > Not quite. The single-letter names mean "I am an iterator/index/etc",
> > but "_" means "I am not used anywhere".
>
> Small addendum to this. pyflakes (at least in my experience) doesn't
> interpret "_" as a variable name or prefix to a local variable as
> "unused".
Interesting. So it would flag this code?
for _ in range(5): next(f) # skip five lines
ChrisA
More information about the Python-list
mailing list