Christian Tismer wrote: > >... > > Are you sure you got what I meant? > I want to compile the variable references away at compile > time, resulting in an ordinary format string. > This string is wraped by the runtime _(), and > the result is then interpolated with a dict. How can that be? Original expression: _($"$foo") Expands to: _("%(x1)s"%{"x1": foo}) Standard Python order of operations will do the %-interpolation before the method call! You say that it could instead be _("%(x1)s")%{"x1": foo} But how would Python know to do that? "_" is just another function. There is nothing magical about it. What if the function was instead re.compile? In that case I would want to do the interpolation *before* the compilation, not after! Are you saying that the "_" function should be made special and recognized by the compiler? Paul Prescod
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4