I want to propose a try-except expression to handle expression errors not stmt 
errors (Yes I initially proposed stmt but now I'm changing it to expressions 
after I researched a little more and found it would make a whole lot of sense 
for expressions.). For example - var if var else var2 - will result in an 
NameError. This is an expression *not* a stmt. So how about having a new type 
of error handling way that handles expression errors and also is an expression 
itself? So let's assume the syntax will be like this -

>>> try expr, Exception exceptexpr

where expr will execute and then exceptexpr will execute if expr raised 
Exception (This may not be the best syntax I could come up with. This is just 
an example. The syntax can be discussed later and will probably end up being 
different from this.).

Thanking you,

With Regards,
Shreyan Avigyan
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/WC75JKT5DD7BRLG4OW5EDZ43M2EPFEDG/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to