Re: [Python-Dev] __eq__ vs hash

2008-04-05 Thread Daniel Krech
On Apr 4, 2008, at 10:38 AM, Guido van Rossum wrote: > On Fri, Apr 4, 2008 at 2:46 AM, Ralf Schmitt <[EMAIL PROTECTED]> wrote: >> the news file for python 2.6 does not mention that you need to define >> __hash__ in case you define __eq__ for a class. >> This breaks some code (for me: mercurial and

Re: [Python-Dev] __eq__ vs hash

2008-04-04 Thread Jean-Paul Calderone
On Fri, 4 Apr 2008 07:38:04 -0700, Guido van Rossum <[EMAIL PROTECTED]> wrote: >On Fri, Apr 4, 2008 at 2:46 AM, Ralf Schmitt <[EMAIL PROTECTED]> wrote: >> the news file for python 2.6 does not mention that you need to define >> __hash__ in case you define __eq__ for a class. >> This breaks some cod

Re: [Python-Dev] __eq__ vs hash

2008-04-04 Thread Dirkjan Ochtman
Paul Moore wrote: > That looks like it. I'll work up a patch and submit it to the > Mercurial developers. I've already got one going. Cheers, Dirkjan ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev

Re: [Python-Dev] __eq__ vs hash

2008-04-04 Thread Paul Moore
On 04/04/2008, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > It doesn't use __hash__ at all. It uses __eq__ in two files, three total > uses: > > > http://hg.intevation.org/mercurial/crew/file/6c4e12682fb9/mercurial/commands.py > > > http://hg.intevation.org/mercurial/crew/file/6c4e1268

Re: [Python-Dev] __eq__ vs hash

2008-04-04 Thread Guido van Rossum
On Fri, Apr 4, 2008 at 8:08 AM, Jason Orendorff <[EMAIL PROTECTED]> wrote: > On Fri, Apr 4, 2008 at 9:38 AM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > > What specific code breaks? Maybe we need to turn this into a warning > > in order to be more backwards compatible? > > I looked at Mercu

Re: [Python-Dev] __eq__ vs hash

2008-04-04 Thread Jason Orendorff
On Fri, Apr 4, 2008 at 9:38 AM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > What specific code breaks? Maybe we need to turn this into a warning > in order to be more backwards compatible? I looked at Mercurial. It doesn't use __hash__ at all. It uses __eq__ in two files, three total uses: h

Re: [Python-Dev] __eq__ vs hash

2008-04-04 Thread Guido van Rossum
Understood. Neither do I. :-) But maybe you could get the authors of that code into this discussion? On Fri, Apr 4, 2008 at 7:53 AM, Ralf Schmitt <[EMAIL PROTECTED]> wrote: > > > > On Fri, Apr 4, 2008 at 4:38 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > > > > > > > On Fri, Apr 4, 2008 at 2:

Re: [Python-Dev] __eq__ vs hash

2008-04-04 Thread Ralf Schmitt
On Fri, Apr 4, 2008 at 4:38 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On Fri, Apr 4, 2008 at 2:46 AM, Ralf Schmitt <[EMAIL PROTECTED]> wrote: > > the news file for python 2.6 does not mention that you need to define > > __hash__ in case you define __eq__ for a class. > > This breaks some c

Re: [Python-Dev] __eq__ vs hash

2008-04-04 Thread Guido van Rossum
On Fri, Apr 4, 2008 at 2:46 AM, Ralf Schmitt <[EMAIL PROTECTED]> wrote: > the news file for python 2.6 does not mention that you need to define > __hash__ in case you define __eq__ for a class. > This breaks some code (for me: mercurial and pyparsing). > Shouldn't this be documented somewhere (I al

[Python-Dev] __eq__ vs hash

2008-04-04 Thread Ralf Schmitt
Hi all, the news file for python 2.6 does not mention that you need to define __hash__ in case you define __eq__ for a class. This breaks some code (for me: mercurial and pyparsing). Shouldn't this be documented somewhere (I also cannot find it in the whatsnew file). - Ralf __