Larry Bates wrote:
> abcd wrote:
> 
>>I recently came across a problem where I saw this error:
>>"TypeError: unsubscriptable object"
>>
>>How can I determine if an object is "scriptable" or "unscriptable"?
>>
> 
> Simplest answer is to use isinstance to see if it is a string, list,
> or tuple:
> 
> if isinstance(variable, (str, list, tuple)):

Which will fail for a whole lot of objects that are scriptable...
Better use Daniel's solution or a try/except.

> 
> Now the problem is that this answer doesn't address the problem.
> Your code is attempting to do something to the wrong type of
> object/variable which is a logic problem.

Of course !-)



-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to