Chris Torek <nos...@torek.net> writes: > But again, this is why I would like to have the ability to use some > sort of automated tool, where one can point at any given line of > code and ask: "what exceptions do you, my faithful tool, believe > can be raised as a consequence of this line of code?"
“Why, any exception at all”. > If you point it at the call to main(): > > if __name__ == '__main__': > main() > > then you are likely to get a useless answer ("why, any exception > at all"); but if you point it at a call to os.read(), then you get > one that is useful -- and tells you (or me) about the OverflowError. No. The answer is *still* “why, any exception at all”. The name ‘os.read’ could be re-bound at run-time to any object at all, so a code checker that you “point at any given line of code” can't know what the name will be bound to when that line gets executed. > If you point it at a call to len(x), then the tool tells you what > it knows about type(x) and x.__len__. Which information, before the code is executed, isn't determined. -- \ “The cost of education is trivial compared to the cost of | `\ ignorance.” —Thomas Jefferson | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list