On Wed, 31 Aug 2011 21:01:34 +0000, Chris Torek wrote: > Still, it sure would be nice to have a static analysis > tool that could answer questions about potential exceptions. :-) )
That's an impossibility in a dynamic language. If you call f.read() where f was passed in as a parameter, the exceptions which f.read() may throw depend upon exactly what f is; there's no guarantee that it will actually be a built-in file object, only that it will have a .read() method (otherwise you will get an AttributeError). Even if f was returned from open(), there's no guarantee that __builtins__.open() won't have been replaced by the time of the call. -- http://mail.python.org/mailman/listinfo/python-list