I like this. I think explicitly discussing order of inclusion would be worthwhile. I know it's implied by the approximate equivalents, but actually stating it would improve the PEP, IMO.

For example:

nums = [(1, 2, 3), (1.0, 2.0, 3.0)] 
nset = {*n for n in nums}

Does 'nset' wind up containing integers or floats? Is this a language guarantee?



On Mon, Oct 25, 2021, 9:52 PM Erik Demaine <edemaine@mit.edu> wrote:
On Sat, 16 Oct 2021, Erik Demaine wrote:

> Assuming the support remains relatively unanimous for [*...], {*...}, and
> {**...} (thanks for all the quick replies!), I'll put together a PEP.

As promised, I put together a pre-PEP (together with my friend and coteacher
Adam Hartz, not currently subscribed, but I'll keep him aprised):

https://github.com/edemaine/peps/blob/unpacking-comprehensions/pep-9999.rst

For this to become an actual PEP, it needs a sponsor.  If a core developer
would be willing to be the sponsor for this, please let me know.  (This is my
first PEP, so if I'm going about this the wrong way, also let me know.)

Meanwhile, I'd welcome any comments!  In writing things up, I became convinced
that generators should be supported, but arguments should not be supported;
see the document for details why.

Erik
--
Erik Demaine  |  edemaine@mit.edu  |  http://erikdemaine.org/
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/L6NZLEWOXM2KTGOIX7AHP5L76TLNKDPW/
Code of Conduct: http://python.org/psf/codeofconduct/