I prefer the Python2 solution actually. If we disregard for a moment the madness of &quot;hasattr&quot; actually invoking the attribute code -- if it does invoke it and an error occurs, hasn&#x27;t that proven that the attribute <i>does</i> in fact exist?<p>Picture a type that has a &quot;t.connect()&quot; function, and a &quot;t.data&quot; attribute. The data attribute will fail if connect() hasn&#x27;t been called prior to accessing it.<p>I&#x27;d expect hasattr(t, &quot;data&quot;) to answer true and never raise an error, regardless of when I do it. The only way to do that (if you have to invoke the code in the attribute -- not sure if that is the case) is to catch and return true.<p>Validattr would have been a much better name, yes.