catching exceptions in expressions

Chris Reedy creedy at
Thu Aug 7 21:18:08 CEST 2003

Vaclav Dvorak wrote:
> Hi,
> Did I arouse nobody's interest except for Andrew? Nobody thinks catching 
> exceptions inside expressions would be a cool feature to have?

When Guido designed Python he made a clear separation between statements 
and expressions. (You might want to contrast this with Lisp where there 
is no difference between statements and expressions.) I find myself 
occasionally rebelling against this, most usually when using lambda 
expressions, where statements might come in handy. As I've gotten used 
to Python, I've also gotten used to the "Pythonic" notion that the way 
to handle these situations is to define a function and then invoke it.

> Andrew Dalke wrote:
>> Vaclav Dvorak:
>> [big snip]
>>> Comments? Should I write a PEP? Am I missing something obvious? Has this
>>> been debated a million times over already?
>> Feel free to write a PEP.  It won't be accepted.
> Why? You're the only one who doesn't like it, so far. ;-) Of course, 
> you're also the only one who voiced any opinion, so that leaves me with 
> a not so huge statistical sample of one. :-)

Were you here for the great "if-then-else" operator war? Given all the 
controversy associated with adding an if-then-else expression, I think 
any proposal to add any form of try-except expression is certainly 
doomed to failure.


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----

More information about the Python-list mailing list