[A]
This error generally occurs when None assigned to multiple values.
[Case]
It defines the following function
def test():
if value == 1:
a = b = 1
return a,b value = 0 a,b = test()
The implementation of this test program will complain: "TypeError: 'NoneType' object is not iterable"
This is without taking into account the circumstances else, when if condition is not satisfied, the function returns the default None.
When you call, the None assigned to a, b
It is equivalent to a, b = None
There have been such a mistake.
【in conclusion】
1. None will be assigned to more than one value, there will be prompt: TypeError: 'NoneType' object is not iterable
2. The function returns the value to the cover must consider the conditional branch
3. In the absence of a return statement, python default will return None
Knowledge to share with everyone, but to bring the original link is respect for the author.