On Sun, Apr 19, 2020 at 7:00 AM Chris Angelico <ros...@gmail.com> wrote:

> Yes, exactly. One strike doesn't mean it's out, and with a proposal
> like this, it's a matter of looking at a whole lot of imperfect
> alternatives and seeing which tradeoffs we want to go with. (And
> status quo is one such alternative, with tradeoffs of "names need to
> be duplicated".)
>

I think you've missed on alternative.  Well, it's a variation on "status
quo":  Use a silly magic helper function like my Q() or Alex' dict_of() in
his sorcery library.  (Albeit, I tried his library, and it seemed to have a
bug I filed an issue on, which might be fixed yesterday; I haven't tried
again).

But if anyone really wants abbreviated calls with parameters now, they can
use:

    process_record(**Q(email, firstname, lastname, cellphone))

That gets skipping `email=email, ...` if you really want.  And it's within
a character or two of the length of other proposals.

Understand that I'm not really advocating for a magic function like Q().  I
think it's important to keep in mind that anyone COULD create such a thing
for 20 years, and very few people bothered to.  If repeating names was
actually such a big pain point, a decent solution has been available for a
very long time, but it didn't itch enough for many people to write a few
lines with some slight magic to scratch it.

In a number of similar discussion, someone has proposed new syntax to do
something.  And I have often written a little utility function to do
generally the same thing, perhaps with somewhat cryptic internals.  My 15
minute attempts at magic usually have some bugs or limitations, but that's
not really the point.  Many of the new syntax ideas COULD be done with an
arcane function that only needs to be written once (but better than my 15
minute versions). The fact that such magic functions are not in widespread
use, to my mind, argues quite strongly against them actually meriting new
syntax.

Just feeling like some syntax would be clever or cute should not be enough
motivation to add it, which a lot of proposals feel like to me.  We need a
real world advantage.  For that, the commonness of existing workarounds to
do near-equivalent things is very germane.

-- 
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.
_______________________________________________
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/XRGES5MQC4U64PVMAVS4X2MTLPJF4ZW3/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to