On Tue, 2012-10-09 at 10:04 +0930, Chris Withers wrote:
> On 09/10/2012 09:57, Chris McDonough wrote:
> > No. Both hasattr and getattr hide AttributeError.
>
> I knew about hasattr, but how does getattr hide AttributeError?
What you want is for "real" AttributeErrors to bubble up through the
getattr but they don't. For example, if you do this:
class Foo(object):
@property
def __acl__(self):
raise AttributeError('abc')
ob = Foo()
result = getattr(ob, '__acl__', None)
An AttributeError will not be raised, and result will be None.
- C
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.