Patches item #1412451, was opened at 2006-01-22 21:21 Message generated for change (Comment added) made by rhettinger You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1412451&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Modules Group: Python 2.5 Status: Open Resolution: None Priority: 5 Submitted By: Collin Winter (collinwinter) Assigned to: Nobody/Anonymous (nobody) Summary: Fill out the functional module Initial Comment: This patch is an expansion of my earlier patch, #1410119, and should be considered to supersede it. This patch fixes a reference leak in the earlier implementation of foldr. The reference leak was tricky to trigger, but existed. In addition, this patch breaks the functional module into two parts: Modules/_functionalmodule.c and Lib/functional.py. The latter is for list-producing functions which are better implemented as generators (to make them lazier), while the former is reserved for non-list-producing functions, written in C for speed. Lib/functional.py imports the `_functional` module generated from Modules/_functionalmodule.c. The total contents of the functional module: + compose + concat + concatMap + cycle + drop + dropWhile + flip + foldl + foldl1 + foldr + foldr1 + id + iterate + partial + repeat + scanl + scanl1 + scanr + scanr1 + take + takeWhile In addition to a full test-suite and latex-formatted documentation for all functions, this patch also adds a functional/ directory to Demo/ and populates it with examples. After applying this patch, the existing Modules/functionalmodule.c should be removed and replaced with the attached _functionalmodule.c (sorry, I couldn't figure out how to make this show up in an svn diff reliably). The patch is against svn revision 42148. ---------------------------------------------------------------------- >Comment By: Raymond Hettinger (rhettinger) Date: 2006-02-01 14:59 Message: Logged In: YES user_id=80475 I am strongly against the broad expansion of this module until it has lived for some time as a successful, mature, well-loved stand-alone module. Each addition needs to be fully thought-out in terms of use cases and evaluated for clarity/efficacy against existing Python solutions. At some point, there was a substantial discussion on just the compose() function. While it seems basic to functional programming, it was found not to be necessary, and not represent much of an improvement over a simple lambda expression. Also, a number of folks have difficulty remembering whether compose(f,g) means f(g(x)) or g(f(x)). Also, some of these entries duplicate those in the itertools module. It is not in Python's best interests to provide several ways of doing the same thing. ---------------------------------------------------------------------- Comment By: Brett Cannon (bcannon) Date: 2006-02-01 14:15 Message: Logged In: YES user_id=357491 Do note that the function names do not follow the naming convention specified in PEP 8. ---------------------------------------------------------------------- Comment By: Collin Winter (collinwinter) Date: 2006-02-01 05:27 Message: Logged In: YES user_id=1344176 I've updated functional.patch to remove functions that are already handled in itertools. The remaining functions which had been implemented in Python have now all been recoded in C. All functions have seen implementation improvements since the last version of the patch. This patch removes the need for the icky "manually add _functionalmodule.c" part of the original patching instructions. No special actions are necessary now. The patch is against svn revision 42219. ---------------------------------------------------------------------- Comment By: Collin Winter (collinwinter) Date: 2006-01-23 07:55 Message: Logged In: YES user_id=1344176 I've broken the main functional.patch into two subpatches. demo.patch creates and populates the Demo/functional/ directory, while functional.patch does all the rest. Both patches are updated to r42155. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1412451&group_id=5470 _______________________________________________ Patches mailing list [email protected] http://mail.python.org/mailman/listinfo/patches
