On Wed, Feb 14, 2018 at 2:24 PM, D'Arcy Cain wrote:
> A recent post by Terry Jan Reedy got me thinking about formatting. I
> like the new(ish) format method for strings and I see some value in F
> strings but it only works well with locals. Anything more starts
> getting
On 02/15/18 02:56, Peter Otten wrote:
>> class FSTR(str):
>> def __call__(self, *args):
>> return self.format(*args)
>>
>> And here is how it could be used.
>>
>> s = FSTR("ABC {1} {0} {2[x]}")
>
> This can be simplified to
>
> s = "ABC {1} {0} {2[x]}".format
Hmm. Hadn't thought of that.
D'Arcy Cain wrote:
> A recent post by Terry Jan Reedy got me thinking about formatting. I
> like the new(ish) format method for strings and I see some value in F
> strings but it only works well with locals. Anything more starts
> getting messier than format() and it is supposed to be cleaner.
A recent post by Terry Jan Reedy got me thinking about formatting. I
like the new(ish) format method for strings and I see some value in F
strings but it only works well with locals. Anything more starts
getting messier than format() and it is supposed to be cleaner. Also, I
find that I tend to