Opened 8 years ago

Last modified 6 years ago

#17692 needs_work enhancement

The default __invert__ method of an element should avoid coercion — at Version 1

Reported by: Stefan Owned by:
Priority: trivial Milestone: sage-6.5
Component: basic arithmetic Keywords:
Cc: vdelecroix Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by vdelecroix)

Currently, the __invert__ methods in element.pyx do

    return 1/self

This results in a coercion of the integer 1 into the appropriate parent structure. Better would be to do

    return self.parent().one_element() / self

Additionally, the __invert__ method in MultiplicativeGroupElement relies on a method is_one() that is not provided by the class itself.

Change History (1)

comment:1 Changed 8 years ago by vdelecroix

  • Cc vdelecroix added
  • Description modified (diff)

cc'ing me (+ formatting in the description)

Note: See TracTickets for help on using tickets.