That long-neglected ~/src/functional directory has finally guilted me back into action. Responding to a number of user suggestions, here are some things that will be going into the next release of functional:

  • functional.flip will now reverse all non-keyword arguments, as opposed to simply reversing the first two as it does now.

  • I’m going to provide some way of augmenting functional.compose to make up for some of the differences between Python and Haskell (which inspired most of the functional package), namely that Haskell functions are fully curried and Python functions usually aren’t.

    This difference means that you currently can’t do something like this with compose:

    f(*g(*arg,**kw))

    i.e., automatically unpacking g’s return value and passing the result to f.

    One idea I’m kicking around is an unpack keyword argument to compose. Setting this to a true value would result in g’s return value being unpacked before going to f, while setting it to false (the default) would pass the return value straight through. So, to get the functionality outlined above, you’d write something like

    compose(f, g, unpack=True)(*args, **kwargs)
  • Add weakref support to flip and compose objects in the C version.

  • Sundry performance improvements for the C implementation.

I’m hoping to have 0.6 out sometime early next week (maybe 10 or 11 April).

Why do a minor release (from 0.5 to 0.6) instead of a point release (from 0.5 to 0.5.1)? The changes to flip aren’t backwards-compatible, and I want to be sure people know that. Hopefully the current interface will settle down some, and things will tip toward doing more point releases than minor releases.