Message4566
In Python 2.1, when calling the builtin getattr
function and supplying the (optional) default
argument, this default is returned on any exception
raised during PyObject_GetAttr, even if the exception
is not an AttributeError. I did not expect this
behavior after reading the getattr documentation. Is
this the intended behavior? (If so, I think the
documentation should be made clearer on this point.)
Example (providing a non-string as the attribute name):
>>> class Test:
... pass
...
>>> t = Test()
>>> getattr(t, 1, "hello")
'hello'
>>>
|
|
Date |
User |
Action |
Args |
2007-08-23 13:54:25 | admin | link | issue420304 messages |
2007-08-23 13:54:25 | admin | create | |
|