Re: What F strings should have been

2018-02-15 Thread Ian Kelly
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

Re: What F strings should have been

2018-02-15 Thread D'Arcy Cain
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.

Re: What F strings should have been

2018-02-15 Thread Peter Otten
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.

What F strings should have been

2018-02-14 Thread D'Arcy Cain
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