[issue3564] making partial functions comparable

2008-08-22 Thread Terry J. Reedy
Terry J. Reedy <[EMAIL PROTECTED]> added the comment: The default equality comparison of Python objects is by id. Some classes override this, others, in particular, functions, do not. I also agree that partial functions should not either. However, you can subclass functools.partial (I checked in

[issue3564] making partial functions comparable

2008-08-16 Thread Antoine Pitrou
Antoine Pitrou <[EMAIL PROTECTED]> added the comment: I would add that making the comparison "right" for partial would be trickier than it seems: >>> from functools import partial >>> type == type True >>> 1 == 1.0 True >>> partial(type, 1)() == partial(type, 1.0)() False If partial(type, 1) an

[issue3564] making partial functions comparable

2008-08-16 Thread Matt Giuca
Matt Giuca <[EMAIL PROTECTED]> added the comment: It's highly debatable whether these should compare true. (Note: saying "they aren't comparable" is a misnomer -- they are comparable, they just don't compare equal). >From a mathematical standpoint, they *are* equal, but it's impossible (undecida

[issue3564] making partial functions comparable

2008-08-16 Thread Erick Tryzelaar
New submission from Erick Tryzelaar <[EMAIL PROTECTED]>: functools.partial functions are not comparable, in both python 2.5 and 3.0: >>> def foo(): pass >>> functools.partial(foo) == functools.partial(foo) False It can be worked around by comparing the func, args, and keywords, but this means