On Wed, Jun 19, 2002 at 08:52:38AM -0400, Guido van Rossum wrote: > I imagine that the most common use case is a situation where the dict > is already prepared. I think **dict is slower than a positional dict > argument. I agree that keyword args would be useful in some cases > where you can't trust the string. As Barry noted, this isn't as powerful as PEP 215 (er, was that the right number? The earlier $interpolation one, anyway) because it doesn't allow arbitrary expressions. I'd imagine a common use case would be to shortcut an expression without binding it to a local variable, "The length is ${length}".sub(length = len(someString)) In this case it would be handy to use the default environment overridden by the new bindings, so you could do "The length of ${someString} is ${length}".sub(length = len(someString)) But that could get messy real fast. The idiom could be "The length of ${someString} is ${length}".sub(someString = someString, length = len(someString)) But that's ugly. Joe
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