[Python-Dev] functools.compose to chain functions together

Raymond Hettinger python at rcn.com
Sun Aug 16 18:41:54 CEST 2009


[Antoine Pitrou]
> I also think it would be a nice addition.
> (but someone has to propose a patch :-))

I agree with Martin's reasons for rejecting the feature request
(see the bug report for his full explanation).  IIRC, the compose() 
idea had come-up and been rejected in previous discussions as well.

At best, it will be a little syntactic sugar (though somewhat odd because
the traditional mathematical ordering of a composition operator is the
opposite of what intuition would suggest).  At worst, it will be slower
and less flexible than our normal ways of linking functions together.

IMO, its only virtue is that people coming from functional languages
are used to having compose.  Otherwise, it's a YAGNI.


Raymond





More information about the Python-Dev mailing list