I have a piece of Python code:
def func1():
a=set()
b = ','.join(map(str, list(a)))
return b, []
def func2():
d = 1
e = 2
return func1() + (d, e,)
def main():
a,b,c,d = func2()
if __name__ == '__main__':
main()
When I run it through pylint
(1.4.0), I receive the warning:
W: 12, 4: Possible unbalanced tuple unpacking with sequence: left side has 4 label(s), right side has 3 value(s) (unbalanced-tuple-unpacking)
It seems that func2
will always return four results. What does the error mean and why?
If the warning is erroneous, it can be disabled by appending # pylint: disable=unbalanced-tuple-unpacking
to the line.