On 22 February 2014 00:44, Eli Bendersky <eli...@gmail.com> wrote: > True, but at least you still have to explicitly try...except... which takes > a toll on the code so isn't taken lightly. Adding except into expressions, I > fear, will proliferate this usage much more.
The same fears were raised regarding conditional expressions, and they'll be dealt with the same way: style guides and code review. That's also why the examples part of the PEP is so important, though: this is about providing a tool to *improve* readability in the cases where it applies, without significantly increasing the cognitive burden of the language. One example not mentioned in the PEP is that "text.find(substr)" would become just a shorthand for "text.index(substr) except ValueError: -1", but the latter has the benefit that you can substitute "None" instead, which avoids the trap where "-1" is a valid subscript for the string (but doesn't give you the answer you want). Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com