gladman added the comment: On 25/09/2014 17:44, Mark Dickinson wrote: > > Mark Dickinson added the comment: > >> IMHO, the most straight forward way for a new gcd() function to work would >> be to always, predictably return a non-negative value. > > Yes. Any new gcd implementation (in the math module, for example) should > definitely return the unique nonnegative gcd of its inputs. > > In an effort to concentrate the discussion a bit, here's a specific > proposal, deliberately limited in scope: > > 1. Add a new (faster) math.gcd function for Python 3.5, taking two integral > arguments, and returning the unique nonnegative greatest common divisor of > those arguments. > > 2. Deprecate fractions.gcd in Python 3.5 (with a message suggesting that > math.gcd should be used instead), but don't change its behaviour. (The > fractions module would likely be using math.gcd by this point.) > > 3. Remove fractions.gcd in Python 3.6. > > I'd suggest that tangents about gcd of more than two arguments, gcd of > rational / Decimal / float inputs, etc. be discussed elsewhere. Those are > all things that can be added later if there's a real use-case.
My summary crossed with this plan from Mark, which I support (minus the bit he subsequently retracted). +1 ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22477> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com