[Python-ideas] Make return inside a finally a SyntaxError
Nick Coghlan
ncoghlan at gmail.com
Sat Jul 18 04:48:16 CEST 2009
Michael wrote:
> def f():
> try:
> raise Exception()
> finally:
> return 4
I actually did this on purpose recently. I felt somewhat evil while I
was doing it, but it was the most concise way of getting the behaviour I
wanted.
I'll probably go back and change it at some though, since exploiting
this trick will likely confuse someone in the future.
That said, I think this is in the realm of style guides and lint tools
rather than the compiler.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
More information about the Python-ideas
mailing list