[Python-ideas] Yield-From: Finalization guarantees

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Mar 31 00:12:01 CEST 2009


Nick Coghlan wrote:

> Well, in theory people are meant to be writing "except Exception:"
> rather than using a bare except or catching BaseException - that's a big
> part of the reason SystemExit, KeyboardInterrupt and GeneratorExit
> *aren't* Exception subclasses.

Yes, it probably isn't something people will do very
often. But as long as GeneratorExit is documented as
an official part of the language, we need to explain
how we're dealing with it.

BTW, how official *is* it meant to be? There seems to
be very little said about it in either the Language or
Library Reference.

The Library Ref says it's the "exception raised when a
generator's close() method is called". The Language Ref
says that the close() method "allows finally clauses to
run", but doesn't say how that is accomplished.

And I can't find throw() mentioned anywhere!

-- 
Greg



More information about the Python-ideas mailing list