On Apr 24, 5:28 am, malkarouri <[EMAIL PROTECTED]> wrote: > > What's wrong with raising ZeroDivisionError (not stopping the > exception in the first place)? >
Because when I use your module, call avg (or mean) without args, I should see an error that says, "Hey, you have to pass at least one value in!" ZeroDivisonError doesn't mean that. It means I tried to divide by zero. Naively, I don't see where I was dividing by zero (because I don't remember how to calculate the mean---that's what your code was for.) ValueError does mean that I didn't pass the right kind of arguments in. ValueError("No items specified") would be even clearer. (Or maybe TypeError?) In general, any exception thrown should be meaningful to the code you are throwing it to. That means they aren't familiar with how your code works. -- http://mail.python.org/mailman/listinfo/python-list