Re: [Python-Dev] Equality on method objects

2008-03-10 Thread Guido van Rossum
On Mon, Mar 10, 2008 at 9:20 AM, Adam Olsen <[EMAIL PROTECTED]> wrote: > > On Mon, Mar 10, 2008 at 4:26 AM, Armin Rigo <[EMAIL PROTECTED]> wrote: > > Hi Phillip, > > > > > > On Sun, Mar 09, 2008 at 07:05:12PM -0400, Phillip J. Eby wrote: > > > I did not, however, need the equality of bound m

Re: [Python-Dev] Equality on method objects

2008-03-10 Thread Adam Olsen
On Mon, Mar 10, 2008 at 4:26 AM, Armin Rigo <[EMAIL PROTECTED]> wrote: > Hi Phillip, > > > On Sun, Mar 09, 2008 at 07:05:12PM -0400, Phillip J. Eby wrote: > > I did not, however, need the equality of bound methods to be based on > > object value equality, just value identity. > > > > ...at lea

Re: [Python-Dev] Equality on method objects

2008-03-10 Thread Nick Coghlan
Phillip J. Eby wrote: > At 12:26 PM 3/10/2008 +0100, Armin Rigo wrote: >> In general, "x.append" is interchangeable with "x.append" even if >> "x.append is not x.append", so let's go for the least surprizing >> behavior: "m1.im_self is m2.im_self and m1.im_func==m2.im_func". >> Objection? > > Nope

Re: [Python-Dev] Equality on method objects

2008-03-10 Thread Phillip J. Eby
At 12:26 PM 3/10/2008 +0100, Armin Rigo wrote: >Hi Phillip, > >On Sun, Mar 09, 2008 at 07:05:12PM -0400, Phillip J. Eby wrote: > > I did not, however, need the equality of bound methods to be based on > > object value equality, just value identity. > > > > ...at least until recently, anyway. I do

Re: [Python-Dev] Equality on method objects

2008-03-10 Thread Armin Rigo
Hi Phillip, On Sun, Mar 09, 2008 at 07:05:12PM -0400, Phillip J. Eby wrote: > I did not, however, need the equality of bound methods to be based on > object value equality, just value identity. > > ...at least until recently, anyway. I do have one library that wants > to have equality-based co

Re: [Python-Dev] Equality on method objects

2008-03-09 Thread Phillip J. Eby
At 01:59 PM 3/9/2008 -0800, Guido van Rossum wrote: >Do we have much of a use case for this? I've often had APIs that take a callback that promise to only invoke the callback once, even if it's added more than once. And I've used dicts, lists, and sets for same. I did not, however, need the eq

Re: [Python-Dev] Equality on method objects

2008-03-09 Thread Nick Coghlan
Guido van Rossum wrote: > That said, if there's a use case, I agree that it would be okay with > basing the equality of x.foo and y.foo on whether x and y are the same > object, not on whether x==y (consider 0 .__add__ == 0.0 .__add__). The use case in the issue tracker was maintaining a collectio

Re: [Python-Dev] Equality on method objects

2008-03-09 Thread Guido van Rossum
On Sun, Mar 9, 2008 at 9:51 AM, Adam Olsen <[EMAIL PROTECTED]> wrote: > On Sun, Mar 9, 2008 at 9:02 AM, Armin Rigo <[EMAIL PROTECTED]> wrote: > > Hi all, > > > > In Python 2.5, I made an attempt to make equality consistent for the > > various built-in and user-defined method types. I failed,

Re: [Python-Dev] Equality on method objects

2008-03-09 Thread Adam Olsen
On Sun, Mar 9, 2008 at 9:02 AM, Armin Rigo <[EMAIL PROTECTED]> wrote: > Hi all, > > In Python 2.5, I made an attempt to make equality consistent for the > various built-in and user-defined method types. I failed, though, as > explained in http://bugs.python.org/issue1617161. The outcome of thi

[Python-Dev] Equality on method objects

2008-03-09 Thread Armin Rigo
Hi all, In Python 2.5, I made an attempt to make equality consistent for the various built-in and user-defined method types. I failed, though, as explained in http://bugs.python.org/issue1617161. The outcome of this discussion is that, first of all, we need to decide which behavior is "correct":