Why is break allowed in finally, but continue is not?
Ned Batchelder
ned at nedbatchelder.com
Mon Dec 14 12:37:13 EST 2015
On Sunday, December 13, 2015 at 5:28:44 PM UTC-5, Ben Finney wrote:
> Ned Batchelder <ned at nedbatchelder.com> writes:
> > So why treat 'continue' specially?
>
> I am inclined to agree, but in the opposite direction: a case should be
> made for allowing *any* flow-control statement in an exception-handler's
> 'finally' clause.
I agree, those all seem like bad ideas. But 'continue' has been singled
out for a SyntaxError. Rumor has it that continue was difficult to make
work at all, while the other keywords, while ill-advised, were at least
possible.
--Ned.
More information about the Python-list
mailing list