[Python-ideas] Special keyword denoting an infinite loop

Thomas Allen jsbfox at gmail.com
Sat Jun 28 10:04:24 CEST 2014


Rust language defines a special way to make an infinite loop (
http://doc.rust-lang.org/tutorial.html#loops).

I propose adding the same keyword to Python. It will be very useful for
WSGI servers and will suit as a more convenient replacement for recursion
(hence Python doesn't do TRE). I personally find it much prettier than *while
True* or *while 1*. It won't cause any problems with existing programs,
because *loop* is very rarely used as a variable name.

For instance

while True:
>     do_something()
>     do_something_else()


would turn to

loop:
>     do_something()
>     do_something_else()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140628/a0201ebe/attachment.html>


More information about the Python-ideas mailing list