Hi, On Wed, Jan 02, 2008 at 09:35:33AM -0600, James Bennett wrote: > On Jan 2, 2008 8:20 AM, Forest Bond <[EMAIL PROTECTED]> wrote: > > I disagree. Exceptions represent "exceptional situations," not all of > > which are > > necessarily errors. For instance, SystemExit is not really an error, is it? > > What about StopIteration? > > By that analogy as well, exceptions would be the wrong choice here: > what's "exceptional" about returning a redirect? A 404 or 500 is > exceptional -- it's something outside of otherwise-routine operation. > But redirecting from one page to another *is* a part of routine > operation.
StopIteration represents a routine action: the end of a loop. What is exceptional about it is the interruption in flow, much like a redirection can be thought of as an interruption in content generation (in a view). An exception means "stop what you're doing and deal with this new condition." This is probably a pointless argument, though. Clearly, you prefer to use exceptions exclusively for error conditions, and I don't mind (ab)using them for other purposes as well. I view exceptions as a more general message-passing mechanism with some advantageous properties, not just a red flag to throw when things go sour. I wouldn't use them for everything, but they do lend themselves to some "stop that and do this instead" situations. -Forest -- Forest Bond http://www.alittletooquiet.net
signature.asc
Description: Digital signature