Chris Angelico <ros...@gmail.com>: > On Fri, Dec 12, 2014 at 6:10 PM, Marko Rauhamaa <ma...@pacujo.net> wrote: >> Chris Angelico <ros...@gmail.com>: >> >>> You could deduplicate it by shifting the condition: >>> >>> while True: >>> value = get_some_value() >>> if value not in undesired_values: break >>> >>> But I'm not sure how common this idiom actually is. >> >> Extremely common, and not only in Python. > > Something like it is certainly common, but to justify dedicated > syntax, the pure form has to be so amazingly common as to merit it.
You already showed the perfect dedicated syntax. The variations of the while-True-...-break idiom are limitless. There's little need to "optimize" it further. Marko -- https://mail.python.org/mailman/listinfo/python-list