New submission from Pierre Fortin <p...@pfortin.com>:

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 "mytest N" where N is 1 (fails), 2 (works), 3 (fails).
mytest 1 -- KeyError expected; this was due to infile design change
            adding a digit to previously single char code
mytest 2 -- workaround to actual issue in next test
mytest 3 -- adding [0] fails when used in list comprehension

----------
components: Interpreter Core
files: mytest
messages: 410054
nosy: NetAlien
priority: normal
severity: normal
status: open
title: IndexError inside list comprehension + workaround
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file50548/mytest

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46302>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to