This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tim.peters
Recipients
Date 2001-05-23.01:18:59
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=31435

Oh no:  getattr hooks can raise any exception whatsoever, 
and existing code relies on getattr() treating any 
exception whatsoever as meaning "no attribute of that 
name".  For example, IndexError and KeyError are often 
raised naturally by getattr hooks that fail to resolve a 
name via tree or dict structures.

The specific complaint here is a different story:  the docs 
say the attribute argument must be a string (Unicode, 
whatever -- "a string" <wink>), and I agree that calling 
getattr() with something other than a string argument 
should raise a TypeError instead of pretending it's a 
*possible* attribute name and that there simply isn't any 
attribute with that name (it's not a name at all, so the 
call doesn't make sense).

Jeremy, I see this is assigned to you now.  There are 
enough conflicting opinions here (at least Michael's and 
mine seem to coincide) that perhaps it's time to dump it on 
Guido for Pronouncement.
History
Date User Action Args
2007-08-23 13:54:25adminlinkissue420304 messages
2007-08-23 13:54:25admincreate