Steven D'Aprano wrote:
t = (1, 2, 3)
iterable = [t]
[*t for t in iterable]
If you do the same manual replacement, you get:
[1, 2, 3 for t in iterable]
Um, no, you need to also *remove the for loop*, otherwise
you get complete nonsense, whether * is used or not.
Let's try a less degenerate example, both ways.
iterable = [1, 2, 3]
[t for t in iterable]
To expand that, we replace t with each of the values
generated by the loop and put commas between them:
[1, 2, 3]
Now with the star:
iterable = [(1, 2, 3), (4, 5, 6), (7, 8, 9)]
[*t for t in iterable]
Replace *t with each of the sequence generated by the
loop, with commas between:
[1,2,3 , 4,5,6 , 7,8,9]
Maybe your inability to look past your assumptions and see things from
other people's perspective is just as much a blind spot as our inability
to see why you think the pattern is obvious.
It's obvious that you're having difficulty seeing what
we're seeing, but I don't know how to explain it any
more clearly, I'm sorry.
--
Greg
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/