Steven D'Aprano wrote:
Not "process the sorted list", but reify the sort verb into an actual thing (an object or value) and then process that thing itself.

This is mind-bending when you think about it, far more mind-blowing than the normal linguistic process of nouning verbs and verbing nouns.

I don't think it's all that much different. Consider the
sentences:

"Sorting is an interesting operation. It can be done
efficiently or inefficiently."

Here we temporarily bind the operation "sorting" to
the pronoun "it". That's really the extent of processing
that we do on functions. We don't actually do anything
to the functions, we just give them temporary names.

(Unless you go in for bytecode hacking or something,
but beginners aren't going to be doing things like
that.)

It took me a long time to stop writing code like this:

    map(lambda x: len(x), sequence)

instead of simply map(len, sequence).

Is that because you found the concept itself difficult
to grok, or did you just have trouble seeing opportunities
to apply it?

If you saw map(len, sequence) in someone else's code,
did you immediately recognise what it was doing, or did
you have to stop and think about it?

--
Greg
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to