1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
'test unpacking variables'
def func1():
'should not warn'
x, z = (5, 2)
def func2():
'should warn'
x, y, z = (5, 2)
def func3():
'should warn'
a = (5, 2)
x, y, z = a
def func4():
'should warn'
x, = (5, 2)
def func5():
'should warn'
x, y = 5,
def func6():
'should warn'
x, = 5
def func101():
'should not warn'
x, y, z = (5, 2, 3, 4, 5)[:3]
def func102():
'should warn ideally, but size becomes unknown'
x, y, z = (5, 2, 3, 4, 5)[:2]
def func103():
'should not warn'
x, y, z = (5, 2, 3, 4, 5)[2:]
def func104():
'should warn ideally, but size becomes unknown'
x, y, z = (5, 2, 3, 4, 5)[3:]
|