![](https://secure.gravatar.com/avatar/2828041405aa313004b6549acf918228.jpg?s=120&d=mm&r=g)
On 10/22/2020 8:29 AM, Chris Angelico wrote:
Another problem is that using only a literal/display form as a target means you can't pre-assemble a pattern and apply it later:
# Match only the given domain. domain = get_wanted_domain() pattern = 'email: {name}@%s' % domain # ... now what? Right, and you can't do that with f-strings on the RHS either. The specific thing you're asking about could easily be implemented as a feature of the minilanguage itself, but I'm not sure it'd actually be needed. Building patterns for future parsing is simply not the job of
On Thu, Oct 22, 2020 at 8:22 PM Steven D'Aprano <steve@pearwood.info> wrote: this feature - use a regex if you need that.
In the case of f-strings, the fallback is str.format(), which uses the exact same format specifiers. What's the equivalent when you need dynamic 'f-string assignment targets'? Eric