[Python-ideas] Fwd: unpacking generalisations for list comprehension
Steven D'Aprano
steve at pearwood.info
Sun Oct 16 07:23:46 EDT 2016
On Sat, Oct 15, 2016 at 05:38:15PM +0000, Neil Girdhar wrote:
> In ast.c, you can find:
>
> if (is_dict) {
> ast_error(c, n, "dict unpacking cannot be used in "
> "dict comprehension");
> return NULL;
> }
> res = ast_for_dictcomp(c, ch);
[...]
Thanks for the pointer.
> > In any case, it isn't really the difficulty of implementation that
> > is being questioned. Many things are easy to implement, but we still
> > don't do them.
>
> If it doesn't matter, why bring it up?
I never said it doesn't matter.
I brought it up because I'm curious. Because if it turns out that it
actually is *difficult* to implement, that would be a point in my favour
that *t doesn't naturally apply in list comps. And on the other hand, if
it is *easy* to implement, that's a hint that perhaps I'm missing
something and there is some natural interpretation of *t in a list comp
that I've missed. Perhaps.
Just because I have a strong opinion doesn't mean I'm not willing to
consider the possibility that I'm wrong.
--
Steve
More information about the Python-ideas
mailing list