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 r.david.murray
Recipients Igor Kozyrenko (ikseek), r.david.murray, xiang.zhang
Date 2017-06-02.17:42:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1496425330.19.0.290985451782.issue30554@psf.upfronthosting.co.za>
In-reply-to
Content
That's actually a very good question.  hasattr returns False, but is it supposed to be an invariant that if dir returns a string hasattr should return True and getattr should not return AttributeError?  (Well, it might raise AttributeError from inside the attribute, but the attribute itself should be "real".)  Or to put it the other way, if hasattr returns False, should it be an invariant that dir does not list that attribute name?

This may be a question for python-dev, and the answer may well be that we do *not* want to suggest that such an invariant should be expected.  (We of course don't enforce such things, but we do make them hold true in the stdlib if we establish them).  However, it is certainly a surprising behavior, and Python *generally* tries to avoid such surprises.

This may have already been discussed and decided at some previous point, so someone should do some docs and archive searching about it first :)
History
Date User Action Args
2017-06-02 17:42:10r.david.murraysetrecipients: + r.david.murray, xiang.zhang, Igor Kozyrenko (ikseek)
2017-06-02 17:42:10r.david.murraysetmessageid: <1496425330.19.0.290985451782.issue30554@psf.upfronthosting.co.za>
2017-06-02 17:42:10r.david.murraylinkissue30554 messages
2017-06-02 17:42:10r.david.murraycreate