James Corbett <james.h.corb...@gmail.com> added the comment:
I think this would have been a better fit for a StackOverflow issue: https://stackoverflow.com/questions/tagged/python. Also, it's not a compilation error and it doesn't have anything to do with CPython's testing framework. Anyway, I don't think this is a bug. For a string `ch`, it is always true that either `ch != 'n'` or `ch != 'N'`---no string is equal to both `'N'` and `'n'`. Therefore your `while` condition will always be true and the loop will always continue. As you already noted, your loop will terminate properly if you used `and`. You could also rewrite it as `while ch not in ('n', 'N'):` which I think is clearer. ---------- nosy: +jameshcorbett, xtreak type: compile error -> behavior _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue41436> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com