"Fred L. Drake, Jr." <fdrake at acm.org>: > this cost was once attributed with a fairly bad performance > degradation when we tried a nicer message for AttributeError that > caused the exception instance to always be created This suggests that perhaps using exceptions for non-exceptional flow control isn't such a good idea, if it forces things like AttributeError to be less useful for debugging than they would otherwise be. I know the Python philosophy holds that you *should* be able to use exceptions freely for both purposes, but perhaps that philosophy needs to be re-examined in the light of this consideration. I know I find myself preferring these days to use getattr et al with default arguments rather than catching exceptions when testing for the presence of something, as it seems to more directly express what I'm trying to do, and avoids all chance of catching the wrong exception. Perhaps the equivalent should be done inside the interpreter, too? Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg at cosc.canterbury.ac.nz +--------------------------------------+
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