3 ms·
For one thing, `f"something"` is of type `str`; `t"something"` is of type `string.templatelib.Template`. With t-strings, your code can know which parts of the s
by davepeck 2y ago
For one thing, `f"something"` is of type `str`; `t"something"` is of type `string.templatelib.Template`. With t-strings, your code can know which parts of the string were dynamically substituted and which were not.
- deleted 2y ago[deleted]
- all2 2y agoThe types aren't so important. __call__ or reference returns type string, an f and a t will be interchangeable from the consumer side. Example, if you can go through (I'm not sure you can) and trivially replace all your fs with ts, and then have some minor fixups where the final product is used, I don't think a migration from one to the other would be terribly painful. Time-consuming, yes.
- itishappy 2y agoNot sure that's true. `Template`s don't provide a `__str__` function, so you need to pass them to a processing function to get a `str` back. https://peps.python.org/pep-0750/#no-template-str-implementation https://peps.python.org/pep-0750/#no-template-str-implementa...