len() is the Built-in Functions in Python. This is what documentation explain about len() functions.
Return the length (the number of items) of an object. The argument may be a sequence (such as a string, bytes, tuple, list, or range) or a collection (such as a dictionary, set, or frozen set).
So len() function always return an integer value.
>>> _list = []
>>> len(_list)
0 # It's 0, because it's an empty list.
>>> len(_list) == []
False # Yes, because 0 is not equal to list
>>> 0 == []
False # Same as before, len(_list) always return 0
I think You are check the list
is empty or not, can do it easily in this way.
if tasks: # or len(tasks) != 0
# do something when list has one or more values:
else:
# do something when list is empty
You can refer more about from How do I check if a list is empty? question.