On Wed, Oct 21, 2020 at 10:39 AM Steven D'Aprano <st...@pearwood.info> wrote: > > The > > f-string has to be a literal - it's not a magic object that you can > > assign to and new locals appear. > > Well, no, it's not an object at all, but surely "you can assign to and > new locals appear" is the whole point of the feature? You assign to the > f-string and it matches values from the string on the right hand side to > create new locals, or over-write existing ones. > > f"{name}: {value:d}" = "eleventytwo: 112" > > will have the side effect of binding: > > name = "eleventytwo" > value = 112 >
Yes. It's *not an object*. The "spooky action at a distance" thing that I was responding to can't be an issue because the assignment is right there. Please, don't make me repeat all the same arguments again. Read the existing thread. ChrisA _______________________________________________ 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/7STRB5BFBG3IQIWZ6EXP65ELWZ7WTHJR/ Code of Conduct: http://python.org/psf/codeofconduct/