7stud wrote:
> On Jun 23, 11:45 am, walterbyrd <[EMAIL PROTECTED]> wrote:

>> Suppose you are sequentially processing a list with a routine
>> that expects every item to be of a certain type. Something in the
>> list that doesn't conform to the type could give you unexpected
>> results, maybe crash your application.
>>
> 
> if hasattr(elmt, some_func):
>    elmt.some_func()

Personally, I prefer

try:
    elmt.some_func()
except AttributeError:
    # do stuff

Regards,


Björn

-- 
BOFH excuse #130:

new management

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to