25.06.17 14:58, Markus Meskanen пише:
I'm a huge fan of the do...while loop in other languages, and it would often be useful in Python too, when doing stuff like:

while True:
     password = input()
     if password == ...:
         break

In this particular case you could write:

    for password in iter(input, secret_password):
        ...

In more complex cases you can either write more complex generator or just use conditional break. There is nothing wrong with this.

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to