[issue21130] equivalent functools.partial instances should compare equal

2021-03-18 Thread Eryk Sun
Change by Eryk Sun : -- versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.6 ___ Python tracker ___ ___ Python-bugs-list maili

[issue21130] equivalent functools.partial instances should compare equal

2016-06-07 Thread shakur shams Mullick
shakur shams Mullick added the comment: Submitted a new patch addressing the review comments. -- Added file: http://bugs.python.org/file43279/issue_21130_2.patch ___ Python tracker _

[issue21130] equivalent functools.partial instances should compare equal

2016-06-05 Thread Emanuel Barry
Emanuel Barry added the comment: Shakur - Feel free to take over and work on it. Serhiy - I don't think that partial(func) == func should be, in the same sense that (0, 1, 2), [0, 1, 2] and range(3) aren't equal even though they fundamentally represent the same thing. --

[issue21130] equivalent functools.partial instances should compare equal

2016-06-05 Thread shakur shams Mullick
shakur shams Mullick added the comment: Emanuel Barry if you want to take it over, I will stop and will not modify my patch further. Otherwise please let me know. -- ___ Python tracker

[issue21130] equivalent functools.partial instances should compare equal

2016-06-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There is a question: should partial(func) be equal to func? -- ___ Python tracker ___ ___ Python-b

[issue21130] equivalent functools.partial instances should compare equal

2016-06-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I support Jelle's comments and have added other comments. -- nosy: +serhiy.storchaka ___ Python tracker ___ __

[issue21130] equivalent functools.partial instances should compare equal

2016-06-04 Thread Emanuel Barry
Emanuel Barry added the comment: New patch with Jelle's suggestions. I completely removed the macros since we need to (potentially) call Python code with PyObject_IsInstance, and need to check for return code. I also reverted some of the unrelated changes. -- Added file: http://bugs.p

[issue21130] equivalent functools.partial instances should compare equal

2016-06-04 Thread Emanuel Barry
Emanuel Barry added the comment: Git diffs work, but this one doesn't apply cleanly. I manually fixed it and re-generated the patch. Rietveld should pick it up now. Otherwise, what Jelle said. I'm not sure if the macro has the best name though - I'd probably name it `PyPartial_CheckExact` and

[issue21130] equivalent functools.partial instances should compare equal

2016-06-04 Thread Jelle Zijlstra
Jelle Zijlstra added the comment: I think the patch needs more tests, including: - Comparing a partial against some other objects - Comparing two partials with a different function - Comparing two partials with different args You also need to check each call to PyObject_RichCompareBool for error

[issue21130] equivalent functools.partial instances should compare equal

2016-03-18 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +haypo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python

[issue21130] equivalent functools.partial instances should compare equal

2016-02-12 Thread shakur shams Mullick
shakur shams Mullick added the comment: I have submitted a patch for the issue. Please review and give feedback. -- nosy: +shakur shams Mullick ___ Python tracker ___ ___

[issue21130] equivalent functools.partial instances should compare equal

2016-02-12 Thread shakur shams Mullick
Changes by shakur shams Mullick : -- keywords: +patch Added file: http://bugs.python.org/file41909/issue21130.patch ___ Python tracker ___ ___

[issue21130] equivalent functools.partial instances should compare equal

2014-04-05 Thread Raymond Hettinger
Raymond Hettinger added the comment: > I guess a partial is a binding, not a function. Viewed in that light, it makes sense to implement same logic as used for bound methods in method_richcompare. -- keywords: +easy stage: test needed -> needs patch ___

[issue21130] equivalent functools.partial instances should compare equal

2014-04-04 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- stage: -> test needed type: behavior -> enhancement versions: +Python 3.5 ___ Python tracker ___ ___ P

[issue21130] equivalent functools.partial instances should compare equal

2014-04-04 Thread Thomas Heller
Thomas Heller added the comment: My usecase is: I create kind of bound methods with functools.partial. Apologies for the confusion by using the word 'equivalent'; what I mean is that partial instances should (IMO) compare equal when they contain the same function and args/keywords which compar

[issue21130] equivalent functools.partial instances should compare equal

2014-04-02 Thread R. David Murray
R. David Murray added the comment: Of course, as soon as I hit send, I had second thoughts :). I guess a partial is a binding, not a function. -- ___ Python tracker ___ ___

[issue21130] equivalent functools.partial instances should compare equal

2014-04-02 Thread R. David Murray
R. David Murray added the comment: But since the two partial instances are (conceptually, I don't care how they are implemented) two separate functions, then reasoning by analogy from two identical functions not comparing equal, I would expect two partial instances to not compare equal. -

[issue21130] equivalent functools.partial instances should compare equal

2014-04-02 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- Removed message: http://bugs.python.org/msg215397 ___ Python tracker ___ ___ Python-bugs-list mailin

[issue21130] equivalent functools.partial instances should compare equal

2014-04-02 Thread Raymond Hettinger
Raymond Hettinger added the comment: What is the use case? What would be the criteria for comparing functions? Would the func_name have to match? Would the func_defaults have to match? Would the f.__code__.co_names have to match (the internal variable names? Do the function attributes in

[issue21130] equivalent functools.partial instances should compare equal

2014-04-02 Thread eryksun
eryksun added the comment: Function equality is based on identity, as inherited from object. But there's a precedent for this idea in method_richcompare, which compares the method's __func__ and __self__: http://hg.python.org/cpython/file/04f714765c13/Objects/classobject.c#l208 -- no

[issue21130] equivalent functools.partial instances should compare equal

2014-04-02 Thread Thomas Heller
Thomas Heller added the comment: Sure. I'm not sure 'equivalent' is the word I should have used. I suggest (and I would have expected) that partial instances (a, b) should compare equal when a.func == b.func \ and a.args == b.args \ and a.keywords == b.keywords --

[issue21130] equivalent functools.partial instances should compare equal

2014-04-02 Thread Raymond Hettinger
Raymond Hettinger added the comment: Even equivalent functions don't compare as equal: >>> (lambda x: x*x) == (lambda x: x*x) False -- nosy: +rhettinger ___ Python tracker ___

[issue21130] equivalent functools.partial instances should compare equal

2014-04-02 Thread Thomas Heller
New submission from Thomas Heller: I think that 'equivalent' functools.partial objects should compare equal, so the following snippet SHOULD print True: >>> import functools >>> f = lambda x: x >>> a = functools.partial(f, 42) >>> b = functools.partial(f, 42) >>> a == b False >>> -- co