A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2009-January/085671.html below:

[Python-Dev] Partial function application 'from the right'

[Python-Dev] Partial function application 'from the right'Nick Coghlan ncoghlan at gmail.com
Thu Jan 29 23:19:08 CET 2009
Leif Walsh wrote:
> That said, it seems to me that if we're going to add to
> functools.partial, we should go all the way and allow keyword
> arguments (or a dict of them, if it's otherwise too hard to
> implement).  Otherwise, in another few {days, weeks, months} we'll see
> another thread like this clamoring for a keyword-sensitive
> functools.partial.

functools.partial *does* support keyword arguments - it's just that some
functions and methods written in C (such as string methods) *don't*, so
partial's keyword support doesn't help.

A functools.rpartial would go some way towards addressing that.

Using the standalone Ellipsis to denote missing arguments would probably
start to miss the whole point of functools.partial: the only reason for
its existence is that it is *faster than the equivalent Python function*.

If partial starts messing about looking for missing arguments and then
slotting them in, then it is likely to slow down to the point where you
would be better off skipping it and writing a dedicated function that
adds the extra arguments.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4