On Thu, Dec 31, 2009 at 12:01 PM, Stephen Hansen <apt.shan...@gmail.com>wrote:

> On Thu, Dec 31, 2009 at 8:09 AM, Victor Subervi 
> <victorsube...@gmail.com>wrote:
>
>> Hi;
>> I have this code:
>>
>>         sql = 'describe %s %s;' % (optionsStore, option)
>>         print sql
>>         cursor.execute(sql)
>>         descr = cursor.fetchone()
>>         if len(descr) is not None:
>>
>> Python complains:
>>
>> *TypeError*: len() of unsized object
>>
>> Please advise how to rewrite the last line so as to avoid the infamous
>> try/except.
>>
>
> The test itself makes no sense; len returns an integer, and can never be
> None.
>
> Simply do:
>
>    if descr:
>

Thanks, Steven.
beno
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to