a +b ?

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Sun Jun 13 22:45:43 EDT 2010


On Sun, 13 Jun 2010 18:35:52 -0700, alex23 wrote:

> I have little sympathy for Steven's
> hypothetical "new programmer who isn't familiar with map and reduce".

Perhaps you need to spend some more time helping beginners then, and less 
time hanging around Lisp gurus *wink*

> Python isn't PHP, its built-ins are nowhere near as exhaustive,
> something like 80ish vs 2000+ functions? Not exactly a huge lookup
> burden.

It's not the lookup burden, but the mental burden of grasping the idea of 
functions-as-data. Higher-order functions (functions that take functions 
as data) are notoriously difficult for many people to grasp, and even 
some programmers of the calibre of Guido van Rossum never get entirely 
comfortable with (e.g.) reduce. That's why Guido recommends people use a 
for-loop instead of reduce, apply was removed entirely, and list comps 
were introduced as a more friendly alternative to map.

I'm certainly not saying that people should avoid higher-order functional 
code, but merely to remember that map and filter aren't introductory 
concepts, they're moderately advanced functions that many people find 
difficult.


-- 
Steven



More information about the Python-list mailing list