<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > If I try to use y or z inappropriately when they are None, the program > will stop. An alternative is to return an error flag in addition to y > and z from function foo and check the value of the error flag in the > calling program. This seems a bit awkward.
It seems to me you would be undermining the intent of exceptions here. If there is some reason foo() can't proceed with x, then either some sort of a "standard exception" gets thrown as a result of trying to, or you can detect the condition within foo() and raise a custom exception which adequately decribes the problem. Smart callers of foo() are then coded with the knowledge that not all values of 'x' are guaranteed to produce the "normal" results, and have one or more 'except' clauses for them to do whatever it is they think is most appropriate with that exception. HTH! :) -ej -- http://mail.python.org/mailman/listinfo/python-list