I think this should work (i.e., Integer __pow__ should be written so that it does the pythonic thing of giving up so that python can try the other argument's __rpow__ method). Is the fix easy?
class A: def __rpow__(self, base): print self print base return base Integer(2)**A() gives Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/jason/.sage/sage_notebook/worksheets/admin/6/code/115.py", line 12, in <module> _sage_const_2 **A() File "", line 1, in <module> File "integer.pyx", line 1562, in sage.rings.integer.Integer.__pow__ (sage/rings/integer.c:11620) TypeError: instance() argument 1 must be classobj, not sage.rings.integer.Integer Thanks, Jason -- Jason Grout --~--~---------~--~----~------------~-------~--~----~ To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---