2 ms·
>But if there aren't any, it's strange that the design requires every Template processing function to include this boilerplate Other replies gave examples of o
by zahlman 2y ago
>But if there aren't any, it's strange that the design requires every Template processing function to include this boilerplate
Other replies gave examples of other use cases. But the neat thing about Python is that you don't need to "include this boilerplate" for the common cases. It can be wrapped up in a decorator (which could be included in `templatelib`). Or, as you say, in a method on the Template class.
I think I'd implement it as a generator, calling `process_value` (defaulting to `str`) on the Interpolations, so that the caller can still do more with the results (or just `''.join` them).
But these are separate considerations; nothing prevents implementing them later, or indeed adding them to the implementation before the 3.14 release.