initial work for issue 399

not ready for merging
Why this change? 'while 1' is perfectly idiomatic in Python...?