Zachary Ware <zachary.w...@gmail.com> added the comment:
Ideas like this are better sent to the python-id...@python.org mailing list for discussion rather than immediately opening an issue. Note though that I think this has a low chance of acceptance; there's a very high bar to clear to add syntax, even higher for new keywords, and this doesn't seem to buy much over: while True: try: num = int(input("Enter a number: ")) except ValueError: print("I said a *number*") else: break print("The square of your number is", num**2) Especially considering that this version allows you to handle the error however you want, and handle different errors differently, rather than just silently restarting the loop no matter the error. Also, this will be valid in 3.8 and achieve exactly what you're asking for: while not (ans := input("Enter a number: ")).isnumeric(): pass print("The square of your number is", int(ans) ** 2) Do feel free to send your idea to python-ideas anyway, I'm just one opinion :) ---------- nosy: +zach.ware resolution: -> rejected stage: -> resolved status: open -> closed versions: -Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34332> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com