"Ziga Seilnacht" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
| This looks like a bug in Python. It works for all the other
| operators:
|
| >>> class MyInt(int):
| ...     __sub__ = int.__add__
| ...     __mul__ = int.__add__
| ...     __div__ = int.__add__
| ...     __truediv__ = int.__add__
| ...     __floordiv__ = int.__add__
| ...     __mod__ = int.__add__
| ...     __lshift__ = int.__add__
| ...     __rshift__ = int.__add__
| ...     __and__ = int.__add__
| ...     __xor__ = int.__add__
| ...     __or__ = int.__add__
| ...     __pow__ = int.__add__
| ...
| >>> i = MyInt(42)
| >>> i + 3
| 45
| >>> i - 3
| 45
| >>> i * 3
| 45
| >>> i / 3
| 45
| >>> i // 3
| 45
| >>> i % 3
| 45
| >>> i << 3
| 45
| >>> i >> 3
| 45
| >>> i & 3
| 45
| >>> i ^ 3
| 45
| >>> i | 3
| 45
| >>> i ** 3
| 74088
|
| You should submit a bug report to the bug tracker:
|
| http://sourceforge.net/bugs/?group_id=5470

Nice test.  I thought maybe __pow__ might be different in not having a 
reverse form, but indeed, int has an __rpow__ method.

Before submitting, make sure that this does not work in 2.5, and then say 
so in the bug report.  In fact, copy the version/system info that the 
interactive interpreter puts up when it starts.

tjr







-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to