
May 21, 2008
1:51 a.m.
Greg writes:
Christian Heimes wrote:
Thankfully this issue was fixed in Python 2.6 and 3.0. In newer versions of Python hasattr() only swallows exception based on the Exception class but not BaseExceptions.
Shouldn't it only be catching AttributeError, though?
This has come up before - eg http://www.mail-archive.com/python-3000@python.org/msg11630.html - which itself starts with the words "This issue has been raised before" :) It points at http://bugs.python.org/issue504714 regarding 2.x - however, if you follow that thread above, it seems Guido is against changing this behaviour even for 3k. cheers, Mark