On 4/17/20 3:04 PM, Andrew Barnert wrote:
> I can't think of any either...
> You know, an ellipsis is about the farthest thing from an *unmarked*
> elision that you can get [without brackets and reinsertion of a more
> verbose version of the thing you wanted to elide -ed].

Anyone who has read Celine...knows that ellipses...often are inline
operators.  Not just for aposiopesis.

> Multiple people in this thread have criticized the proposal without
> any of them stumbling on what { :spam, :eggs } is intended to mean, at
> least one person noticed that it’s similar to Lisp symbols, one other
> person proposed the exact same thing, etc., and as far as I know all
> of those people are native (at least certainly fluent) speakers of a
> LTR-written language (as were the designers of Lisp, most of the C
> committee, etc.).

I think I'm the first person to mention Lisp symbols.  Maybe not
though.  I have a very different expectation about what `:spam` would
mean based on that analogy than the intended meaning.  I could learn the
semantics, of course.  However, proposals for symbols in Python *do* pop
up from time to time, so this would perhaps make such a thing harder if
it ever becomes desired (which is unlikely, but possible).

My first reading when I see the syntax, however, is something like "that
is a set taken from enumerated values" (per the symbol meaning).  Being
a magic dictionary would be somewhere down the list of the guesses I
would make if I had not seen this discussion... of course, if I was
suddenly given a copy of Python 5.2, transported from the distant
future, I would really just type it in the REPL and probably see a
representation that cued me in.

On Fri, Apr 17, 2020 at 3:59 PM David Mertz <mertz@gnosis.cx> wrote:
I'm kinda leaning -0.5 even on the form that I think is least bad (the mode switch approach).

If typing the same variable from the caller to use in the parameter is really too much repetition, you could maybe just do this:

>>> render_template("index.html",
...     username="display_name",
...     setups="setups",
...     **Q("x y z"))
('index.html',)

{'username': 'display_name', 'setups': 'setups', 'x': 1, 'y': 2, 'z': 3}

Perhaps the spelling of `Q` might be something else.  But in terms of character count, it's not worse than other proposals.

And luckily all you need to do this is get a version of Python later than 1.4 or something like that. :-)

>>> def Q(names):
...     import sys
...     caller = sys._getframe(1)
...     dct = {}
...     for name in names.split():
...         dct[name] = eval(name, globals(), caller.f_locals)
...     return dct


On Fri, Apr 17, 2020 at 2:41 PM Paul Svensson <paul-python@svensson.org> wrote:
For what it's worth, I'm a strong -1 on this whole thing, regardless of syntax.
I think passing a lot of same-named parameters is an anti-pattern, that should be discouraged, not made easier.
Passing an occasional x=x to so some function no disaster;
if it happens often enough to be a problem, IMNSHO, you should look to change your coding style, not the language.

--
Keeping medicines from the bloodstreams of the sick; food
from the bellies of the hungry; books from the hands of the
uneducated; technology from the underdeveloped; and putting
advocates of freedom in prisons.  Intellectual property is
to the 21st century what the slave trade was to the 16th.


--
Keeping medicines from the bloodstreams of the sick; food
from the bellies of the hungry; books from the hands of the
uneducated; technology from the underdeveloped; and putting
advocates of freedom in prisons.  Intellectual property is
to the 21st century what the slave trade was to the 16th.