Using Exceptions for Flow Control?
From a software engineering perspective, using exceptions for flow control is considered a bad practice; exceptions should be used for ... exceptions (exceptional/unexpected behavior, failed preconditions), yet many examples in this book do it. Is this something that Python programmers do often or is the author doing this to illustrate the existence of exceptions? It seems like if the intent is to teach people about a topic, it should be taught in a way that mirrors how it ought to be used (and NOT how it ought NOT be used).
For example, one could argue that there exists a precondition for accessing an element of a dictionary that has_key(key) method should return True. Why not then call that method instead of blindly using the key and catching the exception?