Jun-29-2020, 08:08 AM
Hello everyone,
I want to test "extended iterable unpacking" with set, but the result is unpredictable.
Could somebody tell me what the reason is?
I want to test "extended iterable unpacking" with set, but the result is unpredictable.
d1, *d2, d3 = {1, 2, 3, "a", "acc"} print("d1 =", d1, ", d2 =", d2, ", d3 =", d3) print("type(d1) =", type(d1), ", type(d2) =", type(d2), ", type(d3) =", type(d3))I can get different results as below
Quote:d1 = 1 , d2 = [2, 3, 'acc'] , d3 = a
type(d1) = <class 'int'> , type(d2) = <class 'list'> , type(d3) = <class 'str'>
Quote:d1 = 1 , d2 = [2, 3, 'a'] , d3 = acc
type(d1) = <class 'int'> , type(d2) = <class 'list'> , type(d3) = <class 'str'>
Quote:d1 = acc , d2 = [1, 2, 3] , d3 = a
type(d1) = <class 'str'> , type(d2) = <class 'list'> , type(d3) = <class 'str'>
Could somebody tell me what the reason is?