[Python-Dev] Possible patch for functools partial (original) (raw)
Lie Ryan lie.1296 at gmail.com
Wed May 12 09:49:48 CEST 2010
- Previous message: [Python-Dev] Possible patch for functools partial - Interested?
- Next message: [Python-Dev] Possible patch for functools partial - Interested?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 05/08/10 03:57, Steve Holden wrote:
Steven D'Aprano wrote:
[...] Similarly, if you wanted p1==p2, why not write
p1 = partial(operator.add) p2 = p1 I thought the OP gave a use-case. He's generating "jobs" (partial applied to a callable and arguments), and wanted to avoid duplicated jobs. I think it is reasonable to expect that partial(operator.add, 2) compares equal to partial(operator.add, 2). I don't think he's suggesting it should compare equal to partial(lambda x,y: x+y, 2). Which absence, presumably, also mildly disappoints you?
it disappoints me this does not compare equal:
add3 = lambda a, b, c: a + b + c a = partial(partial(add3, 1), 2) b = partial(partial(add3, 2), 1) print a == b
:-)
- Previous message: [Python-Dev] Possible patch for functools partial - Interested?
- Next message: [Python-Dev] Possible patch for functools partial - Interested?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]