Not a bug, just Python 3 choosing different trade-offs. getattr() and hasattr() are useful for replacing annoying boilerplate like:<p><pre><code>    try:
        foo = x.y
    except Exception:
        foo = None
</code></pre>
If getattr() and hasattr() can raise, then you have to wrap them in try&#x2F;except blocks. So much for that previously useful shorthand.<p>There&#x27;s no good solution here. Either hasattr() can raise (confusing), or it can return false for attributes that exist (also confusing). Maybe if the name was changed (validattr()?), everyone would be OK with the Python 2 behavior.