I decided to see what that would look like, and have included the code here. The change is pretty trivial (adding an __iter__ function to the Compose object) and I went ahead and simplified the __doc__, __name__, and __repr__ functions to take advantage of the fact that you can just use self as an iterable to remove reversed((first,)+funcs).
I don't know how your tests work, but it seems to work fine with all my code. The only way I can imagine this breaking anything is if the code ever checks for iterability to decide if something is a Compose object, but I didn't see anything like that.
I previously suggested that compositions should be iterable in issue https://github.com/pytoolz/toolz/issues/553
I decided to see what that would look like, and have included the code here. The change is pretty trivial (adding an
__iter__
function to the Compose object) and I went ahead and simplified the__doc__
,__name__
, and__repr__
functions to take advantage of the fact that you can just useself
as an iterable to removereversed((first,)+funcs)
.I don't know how your tests work, but it seems to work fine with all my code. The only way I can imagine this breaking anything is if the code ever checks for iterability to decide if something is a Compose object, but I didn't see anything like that.