[issue21136] fractions.Fraction.__pow__ does unneeded renormalization

2016-07-20 Thread Ned Deily
Ned Deily added the comment: I now see Vedran has already opened Issue27539 for this. Sorry for the additional noise. -- ___ Python tracker ___

[issue21136] fractions.Fraction.__pow__ does unneeded renormalization

2016-07-20 Thread Ned Deily
Ned Deily added the comment: @Vedran, the original issue is closed and the code for it already released. Please open a new issue referencing this one, otherwise your comments here will likely be forgotten. -- nosy: +ned.deily versions: -Python 3.6 ___

[issue21136] fractions.Fraction.__pow__ does unneeded renormalization

2016-07-16 Thread Vedran Čačić
Changes by Vedran Čačić : -- type: performance -> behavior ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http

[issue21136] fractions.Fraction.__pow__ does unneeded renormalization

2016-07-16 Thread Vedran Čačić
Vedran Čačić added the comment: Unfortunately, this introduced a bug. It seems Mark Dickinson should go easier on his LGTMs. :-) >>> import fractions >>> fractions.Fraction(-1, 2) ** -1 Fraction(2, -1) That is a really strange object, since it's not normalized, and many functions expect all F

[issue21136] fractions.Fraction.__pow__ does unneeded renormalization

2014-04-05 Thread Mark Dickinson
Mark Dickinson added the comment: Applied. I added an extra test for the `Fraction(0, 1) ** 2` case. -- resolution: -> fixed status: open -> closed ___ Python tracker ___ _

[issue21136] fractions.Fraction.__pow__ does unneeded renormalization

2014-04-05 Thread Mark Dickinson
Changes by Mark Dickinson : -- stage: needs patch -> committed/rejected ___ Python tracker ___ ___ Python-bugs-list mailing list Unsub

[issue21136] fractions.Fraction.__pow__ does unneeded renormalization

2014-04-05 Thread Roundup Robot
Roundup Robot added the comment: New changeset 91d7fadac271 by Mark Dickinson in branch 'default': Issue #21136: Avoid unnecessary normalization in Fractions resulting from power and other operations. http://hg.python.org/cpython/rev/91d7fadac271 -- nosy: +python-dev __

[issue21136] fractions.Fraction.__pow__ does unneeded renormalization

2014-04-04 Thread Mark Dickinson
Mark Dickinson added the comment: LGTM. (For real this time :-). -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscr

[issue21136] fractions.Fraction.__pow__ does unneeded renormalization

2014-04-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thanks Mark, that is an excellent suggestion. -- Added file: http://bugs.python.org/file34719/fraction_pow2.diff ___ Python tracker ___ _

[issue21136] fractions.Fraction.__pow__ does unneeded renormalization

2014-04-03 Thread Mark Dickinson
Mark Dickinson added the comment: (And other operations like `__pos__`, `__neg__` and `__abs__` would benefit from a `_skip_normalization` flag, too.) -- ___ Python tracker ___

[issue21136] fractions.Fraction.__pow__ does unneeded renormalization

2014-04-03 Thread Mark Dickinson
Mark Dickinson added the comment: > Does this work correctly in the case `Fraction(0, 1) ** -2`? Looks like it doesn't. How about adding a `_skip_normalization` keyword argument to `Fraction.__new__` instead? That would ensure that any future changes made to `__new__` don't get skipped by th

[issue21136] fractions.Fraction.__pow__ does unneeded renormalization

2014-04-03 Thread Mark Dickinson
Mark Dickinson added the comment: Hmm. Does this work correctly in the case `Fraction(0, 1) ** -2`? -- ___ Python tracker ___ ___ Pyt

[issue21136] fractions.Fraction.__pow__ does unneeded renormalization

2014-04-03 Thread Mark Dickinson
Mark Dickinson added the comment: LGTM. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.

[issue21136] fractions.Fraction.__pow__ does unneeded renormalization

2014-04-02 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- keywords: +patch Added file: http://bugs.python.org/file34707/fraction_pow.diff ___ Python tracker ___ _

[issue21136] fractions.Fraction.__pow__ does unneeded renormalization

2014-04-02 Thread Raymond Hettinger
Raymond Hettinger added the comment: This looks easily doable. -- assignee: -> rhettinger keywords: +easy ___ Python tracker ___ ___

[issue21136] fractions.Fraction.__pow__ does unneeded renormalization

2014-04-02 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +ezio.melotti, mark.dickinson, rhettinger stage: -> needs patch versions: +Python 3.5 -Python 2.7, Python 3.2 ___ Python tracker ___ _

[issue21136] fractions.Fraction.__pow__ does unneeded renormalization

2014-04-02 Thread William Ehlhardt
New submission from William Ehlhardt: The following Python runs unnecessarily slowly: import fractions fractions.Fraction(6249919, 625) ** 89993 The problem here is that Fraction.__pow__ constructs a new Fraction() to return, and Fraction.__new__ tries to gcd to normalize the numerator/d