[issue46302] IndexError inside list comprehension + workaround
Pierre Fortin
report at bugs.python.org
Sat Jan 8 07:14:26 EST 2022
Pierre Fortin <pf at pfortin.com> added the comment:
[Thanks for the replies! I was trying to post this before seeing them.]
Major egg on face...
The more complex the code becomes, the more likely you will be burned by a rookie mistake...
var = ''
var[0] WILL give IndexError -- Duh!
It was buried in the each.split('=') returning an empty string -- that's what you get for making things easier for the user.
The easier code is to use, the more complex it must be...
Sorry for the noise.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46302>
_______________________________________
More information about the Python-bugs-list
mailing list