A RetroSearch Logo

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

Search Query:

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

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

[Python-Dev] Partial function application 'from the right'Antoine Pitrou solipsis at pitrou.net
Thu Jan 29 18:58:44 CET 2009
Hello,

Ben North <ben <at> redfrontdoor.org> writes:
> 
> I find 'functools.partial' useful, but occasionally I'm unable to use it
> because it lacks a 'from the right' version.  E.g., to create a function
> which splits a string on commas, you can't say
> 
>    # Won't work when called:
>    split_comma = partial(str.split, sep = ',')

In py3k, we could also use "..." (the Ellipsis object) to denote places where an
argument is missing, so that:

    split_comma = partial(str.split, ..., ',')

would do what you want.

Regards

Antoine.


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