On Mon, 14 Jun 2010 23:05:56 -0700, alex23 wrote: > And I'm saying that I hope that most people who are professional > developers are capable of learning such advanced functionality, which > they will never do if there are no effective examples for them from > which to learn. I'm not sure why Python's handling of functions is seen > as any more complex than the way it treats everything as first- class > objects. I fear that not encouraging people to explore this aspect does > limit the language's power for them somewhat.
In my experience, some functional tools are truly mind-blowing (at least they blow *my* mind) but there's nothing difficult about map and reduce. Some people don't like them, and even seem to fear reduce -- I don't get that myself, but there you go. However, the first step in understanding them is to understand that you can use functions as data, and -- again, this is my experience -- some newcomers to programming have great difficulty going from this idiom: code = condition(x) if code == 0: return functionA(x) if code == 1: return functionB(x) if code == 2: return functionC(x) to this first-class function idiom: dispatch_table = {0: functionA, 1: functionB, 2: functionC} code = condition(x) return dispatch[code](x) and from that I surmise that they probably would have problems with other functional forms, such as map, at least at first. Your mileage may vary. > From both Ben & your posts I'm worried that I'm being seen as having > contempt for (at least certain classes of) other developers, when it's > really intended as the contrary. No implication of contempt was meant. I don't think it's contemptuous to assume that people will all meet a certain minimum level of experience, knowledge and general programming skill. Unrealistic, perhaps, but not contemptuous *grin* -- Steven -- http://mail.python.org/mailman/listinfo/python-list