On 09/12/2016 12:05 AM, Michel Desmoulin wrote:
There is also an alternative to this operator, and it's allowing a
shortcut to do:
try:
val = do_thing()
except ThingError:
val = "default"
In the form of:
val = do_thing() except ThingError: "default"
I was debated, and rejected, but I feel like mentioning it again because
it has some strong benefits.
+1
There are many places in my code where this would clean things up a bit. Not
having it is like not having list comps or not having the ternary if-else --
possible, but it would be much nicer to have it.
--
~Ethan~
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/