[Python-Dev] Next-to-last wart in Python syntax.

Guido van Rossum guido@digicool.com
Mon, 12 Mar 2001 18:32:37 -0500


> Contrary to Guido's keynote last week <wink> there are still two warts I
> know of in the current CPython. One is the fact that keywords cannot be used
> as identifiers anywhere, the other is the fact that 'continue' can still not
> be used inside a 'finally' clause. If I remember correctly, the latter isn't
> too hard to fix, it just needs a decision on what it should do :)
> 
> Currently, falling out of a 'finally' block will reraise the exception, if
> any. Using 'return' and 'break' will drop the exception and continue on as
> usual. However, that makes sense (imho) mostly because 'break' will continue
> past the try/finally block and 'return' will break out of the function
> altogether. Neither have a chance of reentering the try/finally block
> altogether. I'm not sure if that would make sense for 'continue' inside
> 'finally'.
> 
> On the other hand, I'm not sure if it makes sense for 'break' to continue
> but for 'continue' to break. :)

If you can fix it, the semantics you suggest are reasonable: continue
loses the exception and continues the loop.

> As for the other wart, I still want to fix it, but I'm not sure when I get
> the chance to grok the parser-generator enough to actually do it :) 

Yes, that was on the list once but got dropped.  You might want to get
together with Finn and Samuele to see what their rules are.  (They
allow the use of some keywords at least as keyword=expression
arguments and as object.attribute names.)

--Guido van Rossum (home page: http://www.python.org/~guido/)