Re: [Python-ideas] Keyword only argument on function call

2018-09-07 Thread Jacco van Dorp
Op vr 7 sep. 2018 om 04:49 schreef Anders Hovmöller : > > Maybe something like this would be better: >> >> f(=a, =b, =c) >> > > Haha. Look at my PEP, it's under "rejected alternative syntax", because of > the super angry replies I got on this very mailing list when I suggested > this syntax a

Re: [Python-ideas] Keyword only argument on function call

2018-09-07 Thread Anders Hovmöller
> I must say I like the idea of being able to write it the way you propose. > Sometimes we make a function only to be called once at a specific location, > more because of factoring out some functions for clarity. Been doing that > myself lately for scripting, and I think it'd increase clarity

[Python-ideas] Python dialect that compiles into python

2018-09-07 Thread Robert Vanden Eynde
Many features on this list propose different syntax to python, producing different python "dialects" that can statically be transformed to python : - a,b += f(x) → _t = f(x); a += _t; b += _t; (augmented assignement unpacking) - a = 2x + 1 → a = 2*x + 1 (juxtaposition is product) - f(*, x, y) →

Re: [Python-ideas] Python dialect that compiles into python

2018-09-07 Thread Anders Hovmöller
Many features on this list propose different syntax to python, producing > different python "dialects" that can statically be transformed to python : > > - a,b += f(x) → _t = f(x); a += _t; b += _t; (augmented assignement > unpacking) > - a = 2x + 1 → a = 2*x + 1 (juxtaposition is product) >

Re: [Python-ideas] Keyword only argument on function call

2018-09-07 Thread Rhodri James
On 07/09/18 03:38, Anders Hovmöller wrote: For comparison, my reaction did indeed involve awe. It was full of it, in fact :-p Sorry, but that syntax looks at best highly misleading -- how many parameters are we passing? I don't like it at all. (nitpick: we're passing arguments, not parameter

Re: [Python-ideas] Keyword only argument on function call

2018-09-07 Thread Anders Hovmöller
> > I counted commas. I came up with the wrong number. Simple. > > For what it's worth, I don't like the keyword-only marker or the > proposed positional-only marker for exactly the same reason. > There's also potentially trailing commas to confuse you further :P I'm not a big fan of the key

Re: [Python-ideas] Keyword only argument on function call

2018-09-07 Thread Rhodri James
On 07/09/18 14:59, Anders Hovmöller wrote: I disagree. Keyword arguments are a fine and good thing, but they are best used for optional arguments IMHO. Verbosity for the sake of verbosity is not a good thing. Hmm.. it seems to me like there are some other caveats to your position here. Like

Re: [Python-ideas] Keyword only argument on function call

2018-09-07 Thread Michael Selik
On Fri, Sep 7, 2018, 12:00 AM Jacco van Dorp wrote: > Sometimes we make a function only to be called once at a specific > location, more because of factoring out some functions for clarity. > I've found myself making the opposite refactoring recently, improving clarity by eliminating unnecessary

Re: [Python-ideas] Keyword only argument on function call

2018-09-07 Thread Robert Vanden Eynde
> > > I disagree. Keyword arguments are a fine and good thing, but they are > best used for optional arguments IMHO. Verbosity for the sake of > verbosity is not a good thing. I disagree, when you have more than one parameter it's sometimes complicated to remember the order. Therefore, when you

Re: [Python-ideas] Keyword only argument on function call

2018-09-07 Thread David Mertz
Here's a function found online (I'm too lazy to write my own, but it would be mostly the same). Tell me how keyword arguments could help this... Or WHAT names you'd give. 1. def quad(a,b,c): 2. """solves quadratic equations of the form 3. aX^2+bX+c, inputs a,b,c, 4. works for all root

Re: [Python-ideas] Keyword only argument on function call

2018-09-07 Thread Robert Vanden Eynde
If you want to force using pos args, go ahead and use Python docstring notation we'd write def quad(a,b,c, /) The names should not be renamed because they already have a normal ordering x ** n. This notation is standard, so it would be a shame to use something people don't use. However, I recent

Re: [Python-ideas] Keyword only argument on function call

2018-09-07 Thread Anders Hovmöller
Do you want to change my PEP suggestion to be about forcing stuff? Because otherwise I don’t see why you keep being that up. We’ve explained to you two times (three counting the original mail) that no one is saying anything about forcing anything. ___

Re: [Python-ideas] Keyword only argument on function call

2018-09-07 Thread Rhodri James
Top posting for once, since no one is quoting well in this thread: Does this in any way answer David's question? I'm serious; you've spent a lot of words that, as best I can tell, say exactly nothing about how keyword arguments would help that quadratic function. If I'm missing something, pl

Re: [Python-ideas] Python-ideas Digest, Vol 142, Issue 22

2018-09-07 Thread James Lu
What if * and ** forwarded all unnamed arguments to a function? Example: import traceback def print_http_response(request, color=True): ... def print_invalid_api_response(error, *, show_traceback=False, **): print_http_response(*, **) if show_traceback: traceback.print_last()

Re: [Python-ideas] Python-ideas Digest, Vol 142, Issue 22

2018-09-07 Thread Ethan Furman
On 09/07/2018 12:09 PM, James Lu wrote: [stuff] James, the digest you replied to had four different topics, and I have no idea how many individual messages. You didn't change the subject line, and you didn't trim the text you were not replying to. Which thread/message were you replying to?

Re: [Python-ideas] Keyword only argument on function call

2018-09-07 Thread Franklin? Lee
On Fri, Sep 7, 2018 at 2:22 PM Rhodri James wrote: > > Top posting for once, since no one is quoting well in this thread: > > Does this in any way answer David's question? I'm serious; you've spent > a lot of words that, as best I can tell, say exactly nothing about how > keyword arguments would

Re: [Python-ideas] Python dialect that compiles into python

2018-09-07 Thread Steven D'Aprano
On Fri, Sep 07, 2018 at 11:57:50AM +, Robert Vanden Eynde wrote: > Many features on this list propose different syntax to python, > producing different python "dialects" that can statically be > transformed to python : [...] > Using a modified version of ast, it is relatively easy to modifi

Re: [Python-ideas] Python dialect that compiles into python

2018-09-07 Thread Ethan Furman
On 09/07/2018 04:57 AM, Robert Vanden Eynde wrote: Actually, I might start to write this lib, that looks fun. You should also check out MacroPy: https://pypi.org/project/MacroPy/ Although I freely admit I don't know if does what you are talking about. -- ~Ethan~ __