On 03.03.2017 09:47, Wolfgang Maier wrote:
However, the fact that else exists generates a regrettable asymmetry in that there is direct language support for detecting one outcome, but not the other.

Stressing the analogy to try/except/else one more time, it's as if "else" wasn't available for try blocks. You could always use a flag to substitute for it:

dealt_with_exception = False
try:
    do_stuff()
except:
    deal_with_exception()
    dealt_with_exception = True
if dealt_with_exception:
    do_stuff_you_would_do_in_an_else_block()

Even worse when we think about the "finally" clause.

Regards,
Sven
_______________________________________________
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