I don't have an opinion one way or the other, but there is a discussion 
on Discourse about the walrus operator:

https://discuss.python.org/t/walrus-fails-with/15606/1


Just a quick straw poll, how would people feel about relaxing the 
restriction on the walrus operator so that iterable unpacking is 
allowed?

    # Currently a syntax error.
    results = (1, 2, (a, b) := (3, 4), 5)

which would create the following bindings:

    results = (1, 2, (3, 4), 5)
    a = 3
    b = 4

A more complex example:

    expression = "uvwxyz"
    results = (1, 2, ([a, *b, c] := expression), 5)

giving:

    results = (1, 2, "uvwxyz", 5)
    a = "u"
    b = ("v", "w", "x", "y")
    c = "z"


Thoughts?


-- 
Steve
_______________________________________________
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/5CWWY4EZKXLJZD47NSQA6TRD5SWMFGOJ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to