Skip to content

spam #134134

Closed as not planned
Closed as not planned
spam#134134
@jabari-max

Description

@jabari-max

The attached patch adds the missing *-unpacking generalizations.
Specifically:

>> a, b, *c = range(5)

>> *a, b, c = a, b, *c
>> a, b, c
([0, 1, 2], 3, 4)
>> [ *a, b, c ]
[0, 1, 2, 3, 4]
>> L = [ a, (3, 4), {5}, {6: None}, (i for i in range(7, 10)) ]
>> [ *item for item in L ]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

Also, yielding everything from an iterator:

>> def flatten(iterables):
...     for it in iterables:
...         yield *it
... 
>> L = [ a, (3, 4), {5}, {6: None}, (i for i in range(7, 10)) ]
>> flatten(L)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

Originally posted by @Yhg1s in #46545

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions