[Python-ideas] Re: Allowing `str.format` to format one or more parameters instead of all parameters

2023-04-28 Thread Greg Ewing
On 29/04/23 6:59 am, Bruce Leban wrote: To take this further, suppose you write 'Hello {username} from {company}'.format(userdata).format(companydata) where the user has set their name to "Dr. {secret} Evil" where {secret} is something in companydata that should not be exposed. More generally

[Python-ideas] Re: Allowing `str.format` to format one or more parameters instead of all parameters

2023-04-28 Thread Bruce Leban
On Tue, Apr 25, 2023 at 6:16 PM Joao S. O. Bueno wrote: > > Worst case scenario, one goes from one non-running program to a running > program producing partially incorrect output. Any legacy code that was not > working in the first place, is obviously, clearly, not critical for anyone, > otherwis

[Python-ideas] Re: Allowing `str.format` to format one or more parameters instead of all parameters

2023-04-28 Thread Matthias Görgens
I suggest you guys implement this as a library, if you want it. You don't need to make your `partial_format` a method, it can just be a normal function. There's no need to fiddle with the built-in string or format function for this. On Fri, 28 Apr 2023, 22:27 Matsuoka Takuo, wrote: > What if i

[Python-ideas] Re: Allowing `str.format` to format one or more parameters instead of all parameters

2023-04-28 Thread MRAB
On 2023-04-28 15:25, Matsuoka Takuo wrote: What if it's done not by format method but by a separete method, say, format_partially or something? The method is different from format also in that it should leave "{{" and "}}" unaltered. On Fri, 28 Apr 2023 at 00:05, Matthias Görgens wrote: Does

[Python-ideas] Re: Allowing `str.format` to format one or more parameters instead of all parameters

2023-04-28 Thread Matsuoka Takuo
What if it's done not by format method but by a separete method, say, format_partially or something? The method is different from format also in that it should leave "{{" and "}}" unaltered. On Fri, 28 Apr 2023 at 00:05, Matthias Görgens wrote: > > Does it have any use case that's not already se