On 4/1/2010 11:15 AM, Robert Madole wrote:
So I just wrote my 1-gazillionth "if hasattr('method', my_object):" and wanted badly to write this.
if 'method' on my_object:
If you do not need the superclass search provided by hasattr,
if 'method' in my_object.__dict__:
'__add__' in int.__dict__
But I otherwise agree with Nick.
Terry Jan Reedy