Python keywords vs. English grammar

Boris Borcic bborcic at gmail.com
Wed May 24 17:51:07 EDT 2006


Roy Smith wrote:
> I noticed something interesting today.  In C++, you write:
> 
> try {
>    throw foo;
> } catch {
> }
> 
> and all three keywords are verbs, so when you describe the code, you can 
> use the same English words as in the program source, "You try to execute 
> some code, but it throws a foo, which is caught by the handler".

Not convincing at all, since the *explicit* throw/raise lexically inside a try 
block with a catch/except clause that's *predetermined* to catch it... is the 
exception rather than the rule. Normally you'd use another form of block exit. 
Or is the case different in C++  by any chance ?

> 
> In Python, you write:

usually, you don't write something similar to that, and neither in C++ I guess.
> 
> try:
>    raise foo
> except:
> 
> and now you've got a mix of verbs and (I think), a preposition.  You can't 
> say, "You try to execute some code, but it raises a foo, which is excepted 
> by the handler".  It just doesn't work grammatically.
> 
> Sigh.



More information about the Python-list mailing list