The rap against "while True:" loops
Aahz
aahz at pythoncraft.com
Sat Oct 17 10:30:55 EDT 2009
In article <mailman.1589.1255781573.2807.python-list at python.org>,
Tim Rowe <digitig at gmail.com> wrote:
>
>The point is that an exception causes a change in program flow, so of
>course they're used for flow control. It's what they do. The question
>is in what cases it's appropriate to use them.
Standard Python idiom:
try:
d[key] += value
except KeyError:
d[key] = value
Maybe you need to re-think "appropriate".
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"To me vi is Zen. To use vi is to practice zen. Every command is a
koan. Profound to the user, unintelligible to the uninitiated. You
discover truth everytime you use it." --reddy at lion.austin.ibm.com
More information about the Python-list
mailing list