Is this a "gotcha" in Python?

Chris Angelico rosuav at gmail.com
Mon Apr 22 16:30:29 EDT 2019


On Tue, Apr 23, 2019 at 6:18 AM DL Neil <PythonList at danceswithmice.info> wrote:
> Yet, because "i" (or "n", "a", or "x"...) does not convey usage-meaning
> - other than, "I am a place-holder"! So, aren't we back to "_"?

Not quite. The single-letter names mean "I am an iterator/index/etc",
but "_" means "I am not used anywhere". So if you're iterating over a
range of integers and doing something with them, "i" is fine, "n" is
fine, but "_" isn't.

ChrisA



More information about the Python-list mailing list