[IronPython] Inconsistency in getattr exceptions
Michael Foord
michael.foord at resolversystems.com
Thu Jun 22 04:41:08 PDT 2006
Hello all,
getattr in IronPython raises different exceptions to CPython for invalid
input.
CPython
>>> getattr(a, None)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: getattr(): attribute name must be string
>>>
IronPython
>>> a = object()
>>> getattr(a, None)
Traceback (most recent call last):
File , line 0, in <stdin>##64
File , line 0, in GetAttr##65
AttributeError: 'object' object has no attribute ''
>>>
Note also that exceptions in IronPython involving a None often print the
empty string, which can be unhelpful. (Which is odd since both
repr(None) and str(None) return 'None'.)
All the best,
Michael Foord
http://www.resolversystems.com
http://www.voidspace.org.uk/python/index.shtml
More information about the users
mailing list