Re: What happened to __cmp__() in Python 3.x?

2009-08-17 Thread Xavier Ho
On Sun, Aug 16, 2009 at 10:33 PM, Mark Lawrence wrote: > > I wasn't discussing __cmp__, I was referring to the quote by Chris Rebert > from the Python docs regarding the rich comparison methods, a discrepancy > between the documentation and the implementation as noted in the link that I > gave, an

Re: What happened to __cmp__() in Python 3.x?

2009-08-16 Thread Raymond Hettinger
[Xavier Ho] > > I've recently made my way to Python 3.1 and I'm not seeing __cmp__() in the > > documentation. > > > Is there a substitution for this special method in 3.1, or do I really have > > to define all six rich comparison methods to work it out? FWIW, there is a recipe for expanding the c

Re: What happened to __cmp__() in Python 3.x?

2009-08-16 Thread Mark Lawrence
Xavier Ho wrote: On Sun, Aug 16, 2009 at 9:49 PM, Mark Lawrence wrote: Unfortunately I don't think it's that easy, see. http://mail.python.org/pipermail/python-list/2008-November/688761.html The issue referenced is still open. This of course assumes that I've posted the correct link this time!

Re: What happened to __cmp__() in Python 3.x?

2009-08-16 Thread Xavier Ho
On Sun, Aug 16, 2009 at 9:49 PM, Mark Lawrence wrote: > > Unfortunately I don't think it's that easy, see. > http://mail.python.org/pipermail/python-list/2008-November/688761.html > The issue referenced is still open. This of course assumes that I've > posted the correct link this time! > I'm no

Re: What happened to __cmp__() in Python 3.x?

2009-08-16 Thread Mark Lawrence
Chris Rebert wrote: On Sat, Aug 15, 2009 at 8:09 AM, Xavier Ho wrote: Hey all, I've recently made my way to Python 3.1 and I'm not seeing __cmp__() in the documentation. Is there a substitution for this special method in 3.1, or do I really have to define all six rich comparison methods to wor

Re: What happened to __cmp__() in Python 3.x?

2009-08-16 Thread Terry Reedy
Xavier Ho wrote: I'm really looking for a way to set up Python classes' natural ordering for sorting purposes. I believe __lt__ (<) is the only method (operator) used by both .sort and heap module. -- http://mail.python.org/mailman/listinfo/python-list

Re: What happened to __cmp__() in Python 3.x?

2009-08-16 Thread Xavier Ho
On Sun, Aug 16, 2009 at 7:38 PM, Mark Lawrence wrote: > > Blast, I posted the wrong flaming link, sorry everybody. > No, don't be sorry. I found your link very informative, and while it's a little mixed, it could be useful. I'm really looking for a way to set up Python classes' natural ordering

Re: What happened to __cmp__() in Python 3.x?

2009-08-16 Thread Mark Lawrence
Chris Rebert wrote: On Sat, Aug 15, 2009 at 1:06 PM, Mark Lawrence wrote: Xavier Ho wrote: Hey all, I've recently made my way to Python 3.1 and I'm not seeing __cmp__() in the documentation. Is there a substitution for this special method in 3.1, or do I really have to define all six rich com

Re: What happened to __cmp__() in Python 3.x?

2009-08-16 Thread Chris Rebert
On Sat, Aug 15, 2009 at 1:06 PM, Mark Lawrence wrote: > Xavier Ho wrote: >> >> Hey all, >> >> I've recently made my way to Python 3.1 and I'm not seeing __cmp__() in >> the >> documentation. >> >> Is there a substitution for this special method in 3.1, or do I really >> have >> to define all six ri

Re: What happened to __cmp__() in Python 3.x?

2009-08-16 Thread Chris Rebert
On Sat, Aug 15, 2009 at 8:09 AM, Xavier Ho wrote: > Hey all, > > I've recently made my way to Python 3.1 and I'm not seeing __cmp__() in the > documentation. > > Is there a substitution for this special method in 3.1, or do I really have > to define all six rich comparison methods to work it out?

Re: What's a good solution to implement rich comparison for user-defined classes? (was: What happened to __cmp__() in Python 3.x?)

2009-08-15 Thread Mark Lawrence
Xavier Ho wrote: Never mind my last email. Google actually found me something at last. I also found this page: http://mail.python.org/pipermail/python-list/2008-November/688591.html That still uses a sloppy way of defining the special methods, and a little chunky. Is there a better way for the

Re: What happened to __cmp__() in Python 3.x?

2009-08-15 Thread Mark Lawrence
Xavier Ho wrote: Hey all, I've recently made my way to Python 3.1 and I'm not seeing __cmp__() in the documentation. Is there a substitution for this special method in 3.1, or do I really have to define all six rich comparison methods to work it out? If this question has already been asked som

What's a good solution to implement rich comparison for user-defined classes? (was: What happened to __cmp__() in Python 3.x?)

2009-08-15 Thread Xavier Ho
Never mind my last email. Google actually found me something at last. I also found this page: http://mail.python.org/pipermail/python-list/2008-November/688591.html That still uses a sloppy way of defining the special methods, and a little chunky. Is there a better way for the lazy me? Ching-Yu

What happened to __cmp__() in Python 3.x?

2009-08-15 Thread Xavier Ho
Hey all, I've recently made my way to Python 3.1 and I'm not seeing __cmp__() in the documentation. Is there a substitution for this special method in 3.1, or do I really have to define all six rich comparison methods to work it out? If this question has already been asked somewhere, I apologise