Steven Bethard wrote:
Sorry, I also meant to add that the other obvious way of dealing with this kind of thing is to make the results keyword parameters:
def get_connection(GOOD=1, BAD_AUTH=2, NO_SERVER=3): if tcp_conn(): if server_allows_conn(): return GOOD else: return BAD_AUTH else: return NO_SERVER
This has the benefit that if your user wants different return values they can specify them, but the disadvantage that someone improperly calling the function with more than 0 parameters will get, instead of an error message, a strange return value.
Another disadvantage is that one must compare the return value by value and not by name. That is, I cannot do something like this:
code = get_connection() if code == NO_SERVER: ...
-- Robert Kern [EMAIL PROTECTED]
"In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter -- http://mail.python.org/mailman/listinfo/python-list