[issue46302] IndexError inside list comprehension + workaround

2022-01-08 Thread Pierre Fortin
Pierre Fortin 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

[issue46302] IndexError inside list comprehension + workaround

2022-01-07 Thread Pierre Fortin
New submission from Pierre Fortin : var = "u2" var.strip()[0] Works as expected, except that it returns IndexError (instead of "u") if used in a list comprehension -- at least, that's where I found it. Attached example script illustrates the issue. Call it with &qu