16.10.21 17:07, Erik Demaine пише: > Extended unpacking notation (* and **) from PEP 448 gives us great ways > to concatenate a few iterables or dicts: > > ``` > (*it1, *it2, *it3) # tuple with the concatenation of three iterables > [*it1, *it2, *it3] # list with the concatenation of three iterables > {*it1, *it2, *it3} # set with the union of three iterables > {**dict1, **dict2, **dict3} # dict with the combination of three dicts > # roughly equivalent to dict1 | dict2 | dict3 thanks to PEP 584 > ``` > > I propose (not for the first time) that similarly concatenating an > unknown number of iterables or dicts should be possible via comprehensions: > > ``` > (*it for it in its) # tuple with the concatenation of iterables in 'its' > [*it for it in its] # list with the concatenation of iterables in 'its' > {*it for it in its} # set with the union of iterables in 'its' > {**d for d in dicts} # dict with the combination of dicts in 'dicts' > ```
It was considered and rejected in PEP 448. What was changed since? What new facts or arguments have emerged? _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@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/WLX7JPMEF3JGLMB4MS3LQKGIDMIL5KID/ Code of Conduct: http://python.org/psf/codeofconduct/