We Recommend

Learning Python Learning Python
The authors of Learning Python show you enough essentials of the Python scripting language to enable you to begin solving problems right away, then reveal more powerful aspects of the language one at a time. This approach is sure to appeal to programmers and system administrators who have urgent problems and a preference for learning by semi-guided experimentation.


Posted By

collin on 11/15/06


Tagged

python function compose reduce functional partial composition


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

anayhk


A multi-function compose


Published in: Python 


URL: http://oakwinter.com/code/functional/documentation/cookbook.html

Since the version of compose() that ships with functional only allows you to compose two functions, I present this version that composes n functions.

  1. from functional import partial, compose
  2.  
  3. multi_compose = partial(reduce, compose)

Report this snippet 

You need to login to post a comment.