On Jun 24, 2:12 pm, Bjoern Schliessmann <usenet- [EMAIL PROTECTED]> wrote: > 7stud wrote: > > if hasattr(elmt, some_func): > > elmt.some_func() > > Personally, I prefer > > try: > elmt.some_func() > except AttributeError: > # do stuff
That also hides attribute errors that occur within some_func. I think I'd rather know when elmt has an implementation of some_func that is buggy. Thus I prefer the hasattr version. -- http://mail.python.org/mailman/listinfo/python-list