On 6/30/2010 11:39 AM Stef Mientki said...
hello,
I've lot of functions that returns their result in some kind of tuple / list /
array,
and if there is no result, these functions return None.
Now I'm often what to do something if I've more than 1 element in the result.
So I test:
which works fine if beforehand you do
Result = presumedFuncCall() or []
particularly if you want to test len subsequently.
Emile
if len ( Result )> 1 :
But to prevent exceptions, i've to write ( I often forget)
if Result and ( len ( Result )> 1 ) :
So I wonder why len is not allowed on None
and if there are objections to extend the len function .
thanks,
Stef Mientki
--
http://mail.python.org/mailman/listinfo/python-list