3 ms·
The Python interpreter as acting totally sanely. The author is asking it to loop over a list (or any iterable) and destructure each of the elements. But is the
by aidos 3y ago
The Python interpreter as acting totally sanely.
The author is asking it to loop over a list (or any iterable) and destructure each of the elements. But is then providing a a list containing some strings, none of which can be destructured.
Reducing to just the second part of the loop:
[(x, z) for x, _, z, *_ in ["0x2d41854", "3", "0x80001a14", "(0xbffd)"]]
IE in non-list-comprehension form:
for x, _, z, *_ in ["0x2d41854", "3", "0x80001a14", "(0xbffd)"]:
IE, the first element is expanded as:
x, _, z, *_ = "0x2d41854"
Which is clearly nonsensical.