[Python-ideas] Syntactic sugar to declare partial functions
steve at pearwood.info
Sun Aug 12 21:06:13 EDT 2018
Answering a few of Abe's comments out of order...
On Fri, Aug 10, 2018 at 05:20:25PM -0500, Abe Dillon wrote:
> I didn't realize I'd hit such a nerve. [...] I'm truly sorry
> if I hurt your feelings.
> But you seem to have some grudge against me. I don't get all the
> outrage over what I thought was a fairly benign post. Did I do
> something to make you so angry at me? I'd like to resolve whatever it
> is instead of having to deal with this every time I post.
Have we become so sensitive to disagreement that criticism of ideas is
immediately seen as "angry", "a grudge", "outrage"? If so, I find that
sad and worrying.
My feelings aren't hurt, you haven't hit a nerve, I'm not angry at
anything you wrote, and I'm not holding a grudge. I thought we were
discussing *ideas*, not attacking each other. Just because I challenge
your statements doesn't mean I'm attacking you.
> I suspect that most programmers couldn't describe the difference
> between a type and a class.
In Python, there is none.
There is a sense in which types are different from classes, but that
sense is not fundamental, and in practice many languages blur the lines
> I suspect that most programmers couldn't tell you the difference
> between an exception or an error.
There's a school of thought that most programmers can't program.
But regardless, we don't design Python based on the misunderstandings of
the least competent, most ignorant demographic. That's why we have
exceptions, only some of which are errors, and not
I believe that using a well-designed language should gently encourage
the programmer to learn, by example. I didn't know the the functional
programming techniques of map, reduce or partial until I came across
them in Python. I think I'm a better programmer and less ignorant now
than I was for that.
Consequently, when I hear you describing how few programmers know the
term "partial", what I think is "what a great opportunity for them to
learn something new!".
Or not, of course. For those of us who don't care for functional
programming idioms, there's no need to use partial in our own code.
> [Steven D'Aprano]
> > Do you mean to imply that there are people who looked at Python,
> > loved the language, but decided to use something else because they
> > didn't like the choice of the keyword "lambda"?
> No. Not at all. Is that what you got out of my sentence? Am I really
> the one being extreme?
Yes, that's what I got out of your sentence. If you don't mean that, I
don't know what you do mean.
You've said that the choice of keyword, "lambda", has caused harm. Given
the chance to clarify what you meant, you stood by your comment that the
choice of keyword "lambda" has done real, significant, non-trivial harm
to Python (the language, or the community). Presumably you fear the same
thing will happen again if we choose "partial" (otherwise, why raise the
Harm in what sense? That's what I tried to ask earlier, perhaps not as
clearly as I intended.
If the choice of name "lambda" doesn't repel would-be users, or cause
bugs, or harm performance, then what harm does it do?
This is a genuine question. I'm trying to understand your comments, not
just dismiss them.
You made a comment much stronger than merely "I don't like the name",
claiming that the name is harmful. I could just dismiss your comment as
meaningless hyperbole and ignore it, but I thought to give you the
respect of assuming that you might be correct but I just wasn't
understanding why. Hence my question.
> [Steven D'Aprano]
> > Remember that to millions of programmers in the world, "function" is
> > just as much an obscure foreign piece of jargon they have to memorise as
> > "lambda" is to English-speakers.
> Maybe we should use Egyptian Hieroglyphs then. Even the playing field. It
> doesn't matter anyway, right? It's all nonsense to someone...
No, we ought to stick to ASCII, for reasons I've discussed recently in
other threads. And Python does have a long-standing tradition of
sticking to mostly English words, a tradition for which I personally am
But we ought to "check our privilege", as they say. I think that if we
as a community automatically reject any word because it isn't "plain
English", that would be a sign of unexamined privilege and quite rude to
boot. How can we insist that 3/4 of the world learn English words to use
Python, if we aren't even willing to move out of our own comfort zone to
the extent of learning accurate jargon terms from our own profession?
None of this is to rule out "given". (I think it's certainly better than
Perl's choice of "assuming".) But if we go down this path (which is by
no means decided!), and choose "given" over "partial", we ought to be
clear about the reasons why.
More information about the Python-ideas