On Fri, Sep 18, 2020, 6:35 AM Alex Hall
The point is that this:
(a, b) = c
is 'assigning to a literal' just as much as this:
f"{a} {b}" = c
Both are just things that look like expressions with dynamic values but aren't.
I agree with you. It's not that whacky in principle. But it still looks very odd. One reason might be because there's "stuff" inside the fstring that isn't getting assigned to (str characters). Tuple assignment syntax doesn't have that extra stuff. Why not just grow a parse method on str that returns a dict and do it this way? q = "{a} {b}" p = "1 2" (a, b) = q.parse(p) Or with the q template string literal: (a, b) = "{a} {b}".parse(p) Yes you write the a and b twice, just as with the format method: p = "{a} {b}".format(a=1, b=2) My point is that for symmetry of usability, if you're going to have the f string assignment syntax you should have a template str parse method too. And the parse method should be decided on first.