Req. for feedback -- writings on error handling & cleanup (Py3)

Alf P. Steinbach alfps at
Mon Apr 19 05:29:28 EDT 2010

After at least 3 false starts on my programming introduction's chapter 3, and 
some good and bad feedback from this group[1], I finally think the present 
chapter 3 approach is Good (enough).

So no, I haven't given up in this book project, even though 4 months to produce 
these chapter 3's first 30 pages or so might seem excessive!

This is a PDF document [03 - asd.pdf] at Google Docs, available via


I've tried to take earlier feedback to heart. E.g. verbosity: earlier attempt's 
1+ page intro reduced to 1 line. And example selection: no scary math here.

Contents so far:

3 [chapter title, undecided].
3.1 Error handling.
3.1.1 Error, failure, success (terminology).
3.1.2 The concept of exceptions.
3.1.3 Routine call hierarchies, call stack unwinding and stack traces.
3.1.4 Raising an exception / exception types / exception objects.
3.1.5 Handling an exception by using a try statement.
3.1.6 Interlude I: numerical input in a console program.
3.1.7 Exception translation and chained exceptions.
3.2 Cleanup handling.
3.2.1 Why automatic cleanup via object destruction (RAII) is ungood in Python.
3.2.2 Performing cleanup by using a finally clause (low level technique).
3.2.3 Performing cleanup by using a with statement.

Comments welcome!


- Alf

[1] I'm posting this only to [comp.lang.python], for now seeking feedback mainly 
on the language aspects and general approach. Partially that's because, 
empirically, there is some risk of a flame war erupting in this group, and I 
don't want that spilling over into some other group. If/when the chapter's draft 
is complete I'll cross-post a request for feedback to [comp.programming], or 
perhaps post only to that group for the more pedagogical aspects.

More information about the Python-list mailing list