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 :-) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com