Counting Things in Python: A History
The try block method would be considered bad in most languages, and I hope it is considered bad in Python as well. Using exception handling as part of a normal flow of control is bad style, bad taste, and bad for performance.<p>EDIT: I'm glad to see the Python documentation addresses this: <a href="https://docs.python.org/2/faq/design.html#how-fast-are-exceptions" rel="nofollow">https://docs.python.org/2/faq/design.html#how-fast-are-excep...</a>