Author tim.peters
Recipients mark.dickinson, pablogsal, rhettinger, skrah, steven.daprano, tim.peters
Date 2019-02-19.05:34:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1550554455.13.0.54003501046.issue36027@roundup.psfhosted.org>
In-reply-to
Content
- Some form of this would be most welcome!

- If it's spelled this way, put the modulus argument last?  "Everyone expects" the modulus to come last, whether in code:

    x = (a+b) % m
    x = a*b % m
    x = pow(a, b, m)

or in math:
    
    a^(k*(p-1)) = (a^(p-1))^k = 1^k = 1 (mod p)

- Years ago Guido signed off on spelling this

    pow(value, -1, modulus)

which currently raises an exception.  Presumably

    pow(value, -n, modulus)
    
for int n > 1 would mean the same as pow(pow(value, -1, modulus), n, modulus), if it were accepted at all.  I'd be happy to stop with -1.

- An alternative could be to supply egcd(a, b) returning (g, x, y) such that

     a*x + b*y == g == gcd(a, b)

But I'm not sure anyone would use that _except_ to compute modular inverse.  So probably not.
History
Date User Action Args
2019-02-19 05:34:15tim.peterssetrecipients: + tim.peters, rhettinger, mark.dickinson, steven.daprano, skrah, pablogsal
2019-02-19 05:34:15tim.peterssetmessageid: <1550554455.13.0.54003501046.issue36027@roundup.psfhosted.org>
2019-02-19 05:34:15tim.peterslinkissue36027 messages
2019-02-19 05:34:15tim.peterscreate