Opened 13 years ago

Last modified 4 years ago

#5082 new enhancement

Remove power_mod function

Reported by: burcin Owned by: somebody
Priority: minor Milestone: sage-wishlist
Component: basic arithmetic Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by jdemeyer)

The power_mod function is redundant, since python already supports this.

sage: pow?
Type:           builtin_function_or_method
Base Class:     <type 'builtin_function_or_method'>
String Form:    <built-in function pow>
Namespace:      Python builtin
    pow(x, y[, z]) -> number
    With two arguments, equivalent to x**y.  With three arguments,
    equivalent to (x**y) % z, but may be more efficient (e.g. for longs).
Class Docstring:
    <attribute '__doc__' of 'builtin_function_or_method' objects>

This would call the __pow__ method of the function in question with the right arguments, so we can handle the modulo powering operation in the right place. Recall that the signature of the __pow__ method is actually:

__pow__(self, other[, modulus]).

So the objective of this ticket should be changed to:

  • change the __pow__ methods in sage.structure.element to accept a third argument
  • deprecate sage.rings.arith.power_mod
  • deprecate Integer.powermod

Change History (1)

comment:1 Changed 4 years ago by jdemeyer

  • Description modified (diff)
  • Report Upstream set to N/A
  • Summary changed from remove power_mod method to Remove power_mod function
Note: See TracTickets for help on using tickets.