T Strings - Why there is no built in string rendering?

2 weeks ago 10

I like the idea of T Strings and here is a toy example:

name: str = 'Bob' age: int = 30 template = t'Hello, {name}! You are {age} years old.' print (template.strings) print(template. interpolations) print(template. values) ('Hello, ', '! You are ', ' years old.') (Interpolation('Bob', 'name', None, ''), Interpolation(30, 'age', None, '')) ('Bob', 30)

But why isn't there a

print(template.render)

# → 'Hello, Bob! You are 30 years old.'

submitted by /u/UsernamesArentClever to r/Python
[link] [comments]
Read Entire Article