Sat 28 Jan 2006
Since I clearly don’t have enough on my plate, I’ve started a new project: functional, an effort to bring functional programming tools to Python.
functional provides a pure-Python implementation of numerous tools common in functional programming, such as foldl, foldr, take, flip, as well as mechanisms for partial function application and function composition.
In addition, this project serves as a test-bed for the functional module that will be shipped with Python 2.5. While the module to be shipped with Python will be partially written in C for speed, my module is written in Python to gain readability and portability.
While the functional project is currently pure Python, future releases will see the project broken into two branches. One will stay pure Python, aiming for maximum portability and readability, while the other will be a C/Python hybrid designed for speed and real-world deployment. Both will offer identical functionality, differing only in their implementation language.
This project began as a single patch to the C-language module in core Python that added strict implementations of foldl and foldr. I quickly replaced that patch with one that added over a dozen more functions and classes to the module. That patch, unfortunately, is still sitting in Python’s patch queue. While I’m still hopeful that my work will make it into mainline Python, I’ll be tending this project in the meantime, allowing people to start using these tools even before Python 2.5 comes out.
January 29th, 2006 at 12:38
i have downloaded and run the example with the document. it’s cool.
but as i have know, isn’t it Our Great BDFL will wipe out function programming such as reduce, filter… etc. in python3000, then …do we have a tommorow ?
January 30th, 2006 at 10:47
It’s true reduce and filter will be going away in Python 3, but that’s still five+ years away. While Guido doesn’t have the highest opinion of functional programming (recursion in particular), that preference can only influence mainline Python. Whatever he pushes out of the core will be picked up by packages like functional.
February 2nd, 2006 at 01:15
[…] The functional project has seen a lot of work since its inception (which predates its announcement). Version 0.1 was released on 19 January, and now less than two weeks later, version 0.5 is making its way to PyPI. […]