A use-case for for...else with no break

Serhiy Storchaka storchaka at gmail.com
Fri Nov 3 06:13:04 EDT 2017


02.11.17 12:10, Steve D'Aprano пише:
> Occasionally it is useful to loop over a bunch of stuff in the interactive
> interpreter, printing them as you go on a single line:
> 
> for x in something():
>      print(x, end='')
> 
> If you do that, the prompt overwrites your output, and you get a mess:
> 
> 
> py> for x in "abcdefgh":
> ...     print(x, end='')
> ...
> py> efghpy>

What the interpreter or configuration do you use? The standard 
interpreter uses '>>> ' as a prompt.




More information about the Python-list mailing list