[New-bugs-announce] [issue5191] Partial function application 'from the right'
report at bugs.python.org
Mon Feb 9 14:59:20 CET 2009
New submission from Ben North <bennorth at users.sourceforge.net>:
The functools module includes a 'partial' class, which allows partial
function application either by positional arguments or keyword
arguments. However, it cannot be used to create, for example, a
function splitting a string on commas, or a function to extracts logs to
base 10. I posted
which suggested a 'partial_right' feature, such that the following would
>>> import functools, math
>>> split_comma = functools.partial_right(str.split, ',')
['a', 'b', 'c']
>>> log_10 = functools.partial_right(math.log, 10.0)
There was some useful discussion, but generally the feeling was that the
extra complexity outweighed the potential benefits. Also, chained
partial applications were troublesome.
The overlap in functionality between 'partial_right' and an existing
patch (#1706256) to allow skipping of positional arguments was raised.
I think the present issue should probably be closed/rejected, but it was
suggested on the mailing list that having the issue and patch on the
record might be useful. Patches are against 2.6.1 source.
title: Partial function application 'from the right'
type: feature request
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce