On Fri, Oct 14, 2016, at 22:38, Steven D'Aprano wrote:
> On Thu, Oct 13, 2016 at 05:30:49PM -0400, Random832 wrote:
> 
> > Frankly, I don't see why the pattern isn't obvious
> 
> *shrug*
> 
> 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. We're *all* having 
> difficulty in seeing things from the other side's perspective here.
> 
> Let me put it this way: as far as I am concerned, sequence unpacking is 
> equivalent to manually replacing the sequence with its items:

And as far as I am concerned, comprehensions are equivalent to manually
creating a sequence/dict/set consisting of repeating the body of the
comprehension to the left of "for" with the iteration variable[s]
replaced in turn with each actual value.

>     t = (1, 2, 3)
>     [100, 200, *t, 300]
> 
> is equivalent to replacing "*t" with "1, 2, 3", which gives us:
> 
>     [100, 200, 1, 2, 3, 300]

I don't understand why it's not _just as simple_ to say:

t = ('abc', 'def', 'ghi')
[*x for x in t]

is equivalent to replacing "x" in "*x" with, each in turn, 'abc', 'def',
and 'ghi', which gives us:

[*'abc', *'def', *'ghi']

just like [f(x) for x in t] would give you [f('abc'), f('def'),
f('ghi')]

> That's nice, simple, it makes sense, and it works in sufficiently recent 
> Python versions.

That last bit is not an argument - every new feature works in
sufficiently recent python versions. The only difference for this
proposal (provided it is approved) is that the sufficiently recent
python versions simply don't exist yet.
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to