Hwy doesn't len(None) return zero ?
Stef Mientki
stef.mientki at gmail.com
Wed Jun 30 14:39:09 EDT 2010
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:
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100630/4821ed29/attachment.html>
More information about the Python-list
mailing list