On Sat, Oct 15, 2016 at 12:48 PM, Steven D'Aprano <st...@pearwood.info> wrote:
> Oh look, just like now:
> py> iterable = [(1, 'a'), (2, 'b')]
> py> [(100, *t) for t in iterable]
> [(100, 1, 'a'), (100, 2, 'b')]
> Hands up anyone who expected to flatten the iterable and get
> [100, 1, 'a', 100, 2, 'b']
> instead? Anyone? No?
I don't know whether that should be provocating or beside the poinnt.
It's probably both. You're putting two expectations on the same
example: first, you make the reasonable expectation that results in
[(100, 1, 'a'), (100, 2, 'b')], and then you ask whether anyone
expected [100, 1, 'a', 100, 2, 'b'], but don't add or remove anything
from the same example. Did you forget to put a second example using
the new notation in there?
Then you'd have to spell it out and start out with [*(100, *t) for t
in iterable]. And then you can ask who expected [100, 1, 'a', 100, 2,
'b']. Which is what this thread is all about.
Python-ideas mailing list
Code of Conduct: http://python.org/psf/codeofconduct/