Your solution will either meet the condition immediatly or enter an endless loop.
It is a pretty dangerous to define loops with conditions that do not change while processing the Python controller. The game will not continue until the Python controller ends. The processing time of your python code needs to be as short as possible.
Have a look at Prof. Monster’s BGE Guide to the GameLoop