> On 17 Jul 2019, at 19:08, Andrew Barnert <abarn...@yahoo.com> wrote: > >> On Jul 15, 2019, at 05:25, Anders Hovmöller <bo...@killingar.net> wrote: >> >> >>>>> (The fact that they’re positional, but passed as if they were keyword, >>>>> accepted as if they were keyword, and then pulled out by iterating **kw >>>>> in order is also confusing.) >>>> >>>> What is positional? >>> >>> The name-value pairs are positional. If the keyword names aren’t being used >>> to match the values to parameter names, or to distinguish the values in any >>> other way, but instead to smuggle in arbitrary extra string values, how >>> else can you handle them but by position? Consider a concrete example, your >>> plot(=lambda x:x*2, =lambda x:x**2). How could plot process that? >> >> It's a syntax error. Just like normal keyword arguments: >> >>>>> def f(**kwargs): print(kwargs) >> ... >>>>> f(a=1, a=2) >> File "<string>", line 1 >> SyntaxError: keyword argument repeated > > Why would two similar but different lambdas (doubling vs. squaring) with > similar but different string forms (one * vs two) give a syntax error?
Well I assumed that was a typo since if it wasn't the question didn't make sense. If it wasn't a typo ithe question would be "how can the code differentiate between two different strings?" which is a bit silly. > I didn’t come up with the plot example, so I don’t know the reason it took > two functions. But let’s say they represent functions for the y and z values > respectively for each x, or the real and imaginary parts of a function on > complex x, or the theta and phi values for each r, or two independent > functions f and g that we want to plot the area between, or whatever. > > So, how does plot know which argument is y and which is a? It can’t be by the > names, because the names are stringified lambda expressions. The stringification produces two different strings. One has one * while the other has two. / Anders _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/N6KDPZHX5LUDPUTFJH5PZ3FLTV3CXYYX/ Code of Conduct: http://python.org/psf/codeofconduct/