hasattr() or "x in y"?

Charles T. Smith cts.private.yahoo at gmail.com
Fri Mar 11 16:53:43 EST 2016


On Fri, 11 Mar 2016 21:44:27 +0000, Charles T. Smith wrote:

> From the performance point of view, which is better: - hasattr()
> - x in y
> 
> TIA
> cts


I just realized that "in" won't look back through the class hierarchy...
that clearly makes them not interchangable, but given we're only
interested in the current dict...



More information about the Python-list mailing list