New submission from Happy Fakeboulder <[email protected]>:
A "while-except" loop, in which it acts like a do-while loop from other
languages, except the condition is "did an exception occur during the execution
of the iteration". One could specify a type of exception at the top, similar to
an except block header. (sorry, I'm an idiot)
Example (the keyword might be different):
# asks for a number until the user gives one properly, then
# calculates the square of it.
whexc ValueError:
num = int(input("Enter a number: "))
print("The square of your number is " + str(num * num)) # assuming whexc works,
this will not cause an error
----------
messages: 323065
nosy: Happy Fakeboulder
priority: normal
severity: normal
status: open
title: Suggestion for a new loop type
type: enhancement
versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue34332>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com