[Python-Dev] Partial function application 'from the right' (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Thu Jan 29 18:58:44 CET 2009
- Previous message: [Python-Dev] Partial function application 'from the right'
- Next message: [Python-Dev] Partial function application 'from the right'
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello,
Ben North <ben 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: splitcomma = 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.
- Previous message: [Python-Dev] Partial function application 'from the right'
- Next message: [Python-Dev] Partial function application 'from the right'
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]