On Mon, 26 Jan 2015 09:43:26 -0500, Barry Warsaw <ba...@python.org> wrote:
> On Jan 25, 2015, at 09:31 PM, R. David Murray wrote:
> 
> >> > > {*x for x in it}
> >> > >
> >> > > which is a set comprehension, while the other is a dict comprehension 
> >> > > :)
> >> > >
> >> > 
> >> > That distinction doesn't bother me -- you might as well claim it's
> >> > confusing that f(*x) passes positional args from x while f(**x) passes
> >> > keyword args.
> >> > 
> >> > And the varargs set comprehension is similar to the varargs list
> >> > comprehension:
> >> > 
> >> > [*x for x in it]
> >> > 
> >> > If `it` were a list of three items, this would be the same as
> >> > 
> >> > [*it[0], *it[1], *it[2]]
> >> 
> >> I find all this unreadable and difficult to understand.
> >
> >I did too, before reading the PEP.
> >
> >After reading the PEP, it makes perfect sense to me.  Nor is the PEP
> >complicated...it's just a matter of wrapping your head around the
> >generalization[*] of what are currently special cases that is going on
> >here.
> 
> It does make sense after reading the PEP but it also reduces the readability
> and instant understanding of any such code.  This is head-scratcher code that
> I'm sure I'd get asked about from folks who aren't steeped in all the dark
> corners of Python.  I don't know if that's an argument not to adopt the PEP,
> but it I think it would be a good reason to recommend against using such
> obscure syntax, unless there's a good reason (and good comments!).

But it is only obscure because we are not used to it yet.  It is a
logical extension of Python's existing conventions once you think about
it.  It will become "obvious" quickly, IMO.

--David
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to