[Python-3000] Total ordering and cmp (original) (raw)
Guido van Rossum guido at python.org
Wed Mar 21 05:16:54 CET 2007
- Previous message: [Python-3000] Total ordering and __cmp__
- Next message: [Python-3000] Total ordering and __cmp__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 3/20/07, Collin Winter <collinw at gmail.com> wrote:
On 3/20/07, Guido van Rossum <guido at python.org> wrote: > I haven't taken any action, and it looks like cmp isn't being > called. I'd rather not add it back; if you want it back, could you at > least write up a brief PEP? A patch would also help; I recall that it > was quite a relief being able to cut it out, so I expect that patching > it back in would be quite cumbersome.
I'm not wild about the idea of reintroducing it. I'd at least like some kind of transition strategy that 2to3 can help with (if not implement entirely). Perhaps something like, "if a class defines a cmp method but not lt, gt, ge, etc, 2to3 will insert those methods, implemented by wrapping calls to cmp() as appropriate".
Or we could just have 2.6 warn about the presence (or use) of cmp -- users can write equivalent code using lt etc. themselves and probably do a better job. Inserting six new methods sounds like a bit of a heavy operation for 2to3. The goal of 2to3 is not to convert all possible programs; it is to make it reasonable to write code that runs warning-free under 2.6 and and can be converted without manual massaging to correct, equivalent 3.0 code.
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-3000] Total ordering and __cmp__
- Next message: [Python-3000] Total ordering and __cmp__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]