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

2023-04-29 Thread Matsuoka Takuo
On Sat, 29 Apr 2023 at 23:36, MRAB wrote: > > On 2023-04-29 08:31, Matsuoka Takuo wrote: > > On Sat, 29 Apr 2023 at 00:52, MRAB wrote: > >> > >> What happens if you do '{open}...{close}'.partial_format(open='{close}'? > >> You get '{close}...{close}', and you're going to have a problem using >

[Python-ideas] Re: Auto dedent -c arguments.

2023-04-29 Thread Jonathan Crall
I can't think of a case where the check for "\n" would result in a false negative. It likely makes sense to do that to keep python startup as lightweight as possible. I've made a PR that implements a proof-of-concept: https://github.com/python/cpython/pull/103998 It's currently done via the

[Python-ideas] Re: Make ellipsis an indicator of missing implementation

2023-04-29 Thread David Mertz, Ph.D.
Moreover, I have worked on a lot of code where ellipsis is used to mean "this branch isn't implemented yet, but doing nothing isn't terrible." I don't love that code. I'd rather it use `pass` and a clarifying comment. But this change would make all that existing code much more broken. On Sat,

[Python-ideas] Re: Make ellipsis an indicator of missing implementation

2023-04-29 Thread Al Sweigart
I agree. Giving punctuation-based syntax like ... a meaning that isn't obvious on reading the code makes for unreadable code. Whereas having `raise Exception ('TODO')` accomplishes the same thing but also allows English documentation. The ... here is open to interpretation, especially as a new

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

2023-04-29 Thread MRAB
On 2023-04-29 08:31, Matsuoka Takuo wrote: On Sat, 29 Apr 2023 at 00:52, MRAB wrote: What happens if you do '{open}...{close}'.partial_format(open='{close}'? You get '{close}...{close}', and you're going to have a problem using that as a format string and replacing only the second '{close}'.

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2023-04-29 Thread Chris Angelico
On Sat, 29 Apr 2023 at 23:01, wrote: > > Ad 4) Wouldn't "<=" be a little more logical than "=>"? The perceived > direction of the "flow" of the default value is exactly opposite, i.e., the > default value is always evaluated and then put *into* the argument. > Using arrows to represent

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2023-04-29 Thread petr
Ad 4) Wouldn't "<=" be a little more logical than "=>"? The perceived direction of the "flow" of the default value is exactly opposite, i.e., the default value is always evaluated and then put *into* the argument. For example: def bisect_right(a, x, lo=0, hi<=len(a), *, key=None):

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

2023-04-29 Thread Matsuoka Takuo
On Sat, 29 Apr 2023 at 00:52, MRAB wrote: > > What happens if you do '{open}...{close}'.partial_format(open='{close}'? > You get '{close}...{close}', and you're going to have a problem using > that as a format string and replacing only the second '{close}'. > > Or how about