New submission from Jean-Paul Calderone <exar...@divmod.com>:

Here's an example of a metaclass with a __cmp__ special:

    exar...@boson:/tmp$ cat metacmp.py
    class X(type):
        def __cmp__(self, other):
            return -1

    class Y:
        __metaclass__ = X

    print Y < Y
    exar...@boson:/tmp$ python2.5 metacmp.py
    True
    exar...@boson:/tmp$ python2.6 metacmp.py
    False
    exar...@boson:/tmp$

In Python 2.6 and Python 2.7a1, the __cmp__ isn't even invoked, as it
was in Python 2.5.

This breaks the ordering of item types in Axiom.  A brief search reveals
that sympy also ran into the problem, but they may have since worked
around it.

----------
components: Interpreter Core
messages: 96334
nosy: exarkun
severity: normal
status: open
title: metaclass __cmp__ is ignored
versions: Python 2.6, Python 2.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7491>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to