> On 08 July 2001, Guido van Rossum said: > > Q. If an operation that failed with an AttributeError now fails with a > > TypeError (or the other way around), how important is that > > incompatibility? Greg Ward: > I generally think of those exceptions as meaning, "You've got a bug in > your code, bozo" so I don't bother catching them (except in the main > loop of GUIs and servers, to show a big scary traceback to the poor user > or dump it in a logfile). That's my view on them too. > However, I think that AttributeError is pretty aptly used for the most > part, and I don't see a great benefit in changing an incorrect > "thing.property" to raise TypeError. Fortunately, that wasn't what I attempted to propose. As I mentioned in my reply to Fredrik, there are/were some cases where you get a surprise AttributeError because a type inconsistency reveals itself when an object doesn't support a required operation. This can go either way: what used to be an AttributeError may become a TypeError, or vice versa. (Sorry, no concrete examples right now besides the previous list(C()) example.) --Guido van Rossum (home page: http://www.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4