Antoine Pitrou <pit...@free.fr> added the comment: > Sure, it's common `defining new functions on other functions`... more > times. Here a stupid example with fold (our reduce). > > @curry > def fold(function, start, sequence): > if len(sequence) == 0: > return start > else: > return fold(function, function(start, sequence[0]), sequence[1:]) > > Now, someone could be define a generic summer function by fold. > > import operator as op > > summer = fold(op.add)
Right... so you defined these helper functions (curry, fold) just to... define a generic summer function? Really? I understand that fold() and curry() may look pretty to functional languages people, but they don't solve any real-world problems that Python doesn't already solve in a neater way. You will have to try a bit harder and showcase examples of *useful* code that are made significantly easier through the use of curry(). (no, generic summer functions are *not* real-world use cases. They are homework exercises for CS students, at best) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue13430> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com