[issue33073] Add as_integer_ratio() to int() objects

2018-10-19 Thread STINNER Victor
STINNER Victor added the comment: New changeset b2e2025941f6a4fdb716bd141d31acf720353d21 by Victor Stinner (Serhiy Storchaka) in branch 'master': bpo-33073: Rework int.as_integer_ratio() implementation (GH-9303) https://github.com/python/cpython/commit/b2e2025941f6a4fdb716bd141d31acf720353d21

[issue33073] Add as_integer_ratio() to int() objects

2018-09-14 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +8732 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://

[issue33073] Add as_integer_ratio() to int() objects

2018-09-14 Thread Raymond Hettinger
Raymond Hettinger added the comment: > The merged PR contains several errors. See comments on GitHub. Some comments were seen after the merge of 8750 and were addressed in 9297. If you want to change the checked in code, please open a separate PR and tracker item. If you want different doc

[issue33073] Add as_integer_ratio() to int() objects

2018-09-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The merged PR contains several errors. See comments on GitHub. -- resolution: fixed -> stage: resolved -> status: closed -> open ___ Python tracker _

[issue33073] Add as_integer_ratio() to int() objects

2018-09-14 Thread Raymond Hettinger
Change by Raymond Hettinger : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___

[issue33073] Add as_integer_ratio() to int() objects

2018-09-14 Thread Raymond Hettinger
Change by Raymond Hettinger : -- pull_requests: +8729 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:/

[issue33073] Add as_integer_ratio() to int() objects

2018-09-14 Thread Raymond Hettinger
Change by Raymond Hettinger : -- pull_requests: +8726 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:/

[issue33073] Add as_integer_ratio() to int() objects

2018-09-13 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 5ac704306f4b81ae3f28d8742408d3214b145e8a by Raymond Hettinger (Lisa Roach) in branch 'master': bpo-33073: Adding as_integer_ratio to ints. (GH-8750) https://github.com/python/cpython/commit/5ac704306f4b81ae3f28d8742408d3214b145e8a -

[issue33073] Add as_integer_ratio() to int() objects

2018-08-12 Thread Lisa Roach
Change by Lisa Roach : -- keywords: +patch pull_requests: +8230 stage: -> patch review ___ Python tracker ___ ___ Python-bugs-list

[issue33073] Add as_integer_ratio() to int() objects

2018-07-23 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: Nofar Schnider -> lisroach nosy: +lisroach ___ Python tracker ___ ___ Python-bugs-list ma

[issue33073] Add as_integer_ratio() to int() objects

2018-07-16 Thread Raymond Hettinger
Raymond Hettinger added the comment: Nofar, do you want to continue to work on this or should I reassign? -- ___ Python tracker ___ ___

[issue33073] Add as_integer_ratio() to int() objects

2018-07-16 Thread STINNER Victor
Change by STINNER Victor : -- nosy: -vstinner ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue33073] Add as_integer_ratio() to int() objects

2018-07-16 Thread Raymond Hettinger
Raymond Hettinger added the comment: I put the easy tag here because it was suitable for our mentees and because it is isn't a very difficult task (literally, this is the definition of "easy"). FWIW, it is not "triaging" when the tag was set by a seasoned core developer who was familiar with

[issue33073] Add as_integer_ratio() to int() objects

2018-07-16 Thread STINNER Victor
Change by STINNER Victor : -- keywords: -easy (C) ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue33073] Add as_integer_ratio() to int() objects

2018-07-16 Thread STINNER Victor
STINNER Victor added the comment: > I assume it's decided what to do -- it may not be easy to do it, but I > wouldn't call it controversial at this point. Ok, I delete "controversal" from my comment :-) To tag an issue as "easy" (or "easy C"), please describe step by step how you would impl

[issue33073] Add as_integer_ratio() to int() objects

2018-07-13 Thread Guido van Rossum
Change by Guido van Rossum : -- nosy: -gvanrossum ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue33073] Add as_integer_ratio() to int() objects

2018-07-13 Thread Guido van Rossum
Guido van Rossum added the comment: I assume it's decided what to do -- it may not be easy to do it, but I wouldn't call it controversial at this point. -- ___ Python tracker ___

[issue33073] Add as_integer_ratio() to int() objects

2018-07-12 Thread STINNER Victor
STINNER Victor added the comment: I remove the "easy (C)" keyword since the feature seems to be controversal (at least, not so easy). -- nosy: +vstinner ___ Python tracker _

[issue33073] Add as_integer_ratio() to int() objects

2018-03-16 Thread Nathaniel Smith
Nathaniel Smith added the comment: Sorry, I misspoke -- I meant he opened a related PR. The PR is to add as_integer_ratio to np.float16, np.float32, np.longdouble, not to add it to the numpy integer types. There are similar issues though. -- ___ Py

[issue33073] Add as_integer_ratio() to int() objects

2018-03-16 Thread Nathaniel Smith
Nathaniel Smith added the comment: Eric Wieser (added to CC) actually just opened a PR for this against NumPy: https://github.com/numpy/numpy/pull/10741 I have weak and mixed feelings about the whole thing: https://github.com/numpy/numpy/pull/10741#issuecomment-373637440 -- nosy: +Er

[issue33073] Add as_integer_ratio() to int() objects

2018-03-15 Thread Mark Dickinson
Mark Dickinson added the comment: [Tim] > [...] what would _you_ like to see done here? Given that float.as_integer_ratio and Decimal.as_integer_ratio already exist, and that I don't have a working time machine right now, I'm in favour of adding int.as_integer_ratio purely for duck-typing re

[issue33073] Add as_integer_ratio() to int() objects

2018-03-15 Thread Tim Peters
Tim Peters added the comment: Thanks, Mark! So if int.as_integer_ratio is added to the core, numpy.int64 won't magically have it too, regardless of whether we do or don't add an implementation to numbers.Rational. As an end user, I'd be surprised if numpy.int64 didn't support the same stuff

[issue33073] Add as_integer_ratio() to int() objects

2018-03-15 Thread Mark Dickinson
Mark Dickinson added the comment: It's a "virtual" subclass. The numpy.integer parent class is registered here: https://github.com/numpy/numpy/blob/10ccfe747a68d974ff16a5c0765054b816d5486f/numpy/core/numerictypes.py#L944 -- ___ Python tracker

[issue33073] Add as_integer_ratio() to int() objects

2018-03-15 Thread Tim Peters
Tim Peters added the comment: Serhiy, I don't understand. If `numbers.Rational` is in fact a superclass of `numpy.int64`, then the latter will inherit an implementation added to the former. The idea here isn't to add an abstract method to the Rational interface, but a concrete default imple

[issue33073] Add as_integer_ratio() to int() objects

2018-03-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Adding as_integer_ratio() to numbers.Rational is a breaking change. It breaks the interface. Currently all numbers.Rational subclasses implement all public methods and properties of the abstract class, but with adding as_integer_ratio() this will be no long

[issue33073] Add as_integer_ratio() to int() objects

2018-03-13 Thread Guido van Rossum
Guido van Rossum added the comment: +1. On Tue, Mar 13, 2018, 16:26 Tim Peters wrote: > > Tim Peters added the comment: > > Thanks, Guido! I figured I was missing something :-) > > It looks like `numbers.Rational` _is_ a "for real" base class of > `fractions.Fraction`, though, so I'm in fav

[issue33073] Add as_integer_ratio() to int() objects

2018-03-13 Thread Tim Peters
Tim Peters added the comment: Thanks, Guido! I figured I was missing something :-) It looks like `numbers.Rational` _is_ a "for real" base class of `fractions.Fraction`, though, so I'm in favor of supplying a default implementation of `.as_integer_ratio()` in `numbers.Rational` anyway. That

[issue33073] Add as_integer_ratio() to int() objects

2018-03-13 Thread Guido van Rossum
Guido van Rossum added the comment: Actually numbers.Rational is a virtual base class for int, so it won't automagically appear there. Adding it to the math module is inferior because for non-rational types (e.g. alternative float implementations) the math module won't have the knowledge abo

[issue33073] Add as_integer_ratio() to int() objects

2018-03-13 Thread Tim Peters
Tim Peters added the comment: Serhiy, we already went down the path of implementing this as a method. Of course `numbers.Rational` could define the method as `return (self.numerator, self.denominator)` for itself and its subclasses. Unless I'm confused, that would "magically" define the me

[issue33073] Add as_integer_ratio() to int() objects

2018-03-13 Thread Raymond Hettinger
Change by Raymond Hettinger : -- keywords: +easy (C) ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue33073] Add as_integer_ratio() to int() objects

2018-03-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Wouldn't be better to add the function as_integer_ration() in the math module (or in more appropriate place)? def as_integer_ration(x): if hasattr(x, 'as_integer_ration'): return x.as_integer_ration() else: return (x.numerator, x.deno

[issue33073] Add as_integer_ratio() to int() objects

2018-03-13 Thread Nofar Schnider
Nofar Schnider added the comment: I'm working on it -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:

[issue33073] Add as_integer_ratio() to int() objects

2018-03-13 Thread Raymond Hettinger
Raymond Hettinger added the comment: > it looks like there's some overlap with the goals of issue #28716 Okay, let's focus this issue on just int.as_integer_ratio() so that Nofar can have something small and self contained to work on :-) -- ___ Pyt

[issue33073] Add as_integer_ratio() to int() objects

2018-03-13 Thread Mark Dickinson
Mark Dickinson added the comment: On the Fraction constructor, it looks like there's some overlap with the goals of issue #28716 here. -- ___ Python tracker ___ __

[issue33073] Add as_integer_ratio() to int() objects

2018-03-13 Thread Mark Dickinson
Change by Mark Dickinson : -- nosy: +mark.dickinson ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue33073] Add as_integer_ratio() to int() objects

2018-03-13 Thread Tim Peters
Tim Peters added the comment: > Is this also desired for fractions.Fraction and numbers.Rational? I think so. The idea, e.g., that "it's obvious" for Fraction is no more compelling than that it's even more obvious for ints ;-) Given that it's spreading to ints anyway, there's an opportunity

[issue33073] Add as_integer_ratio() to int() objects

2018-03-13 Thread Raymond Hettinger
New submission from Raymond Hettinger : Goal: make int() more interoperable with float by making a float/Decimal method also available on ints. This will let mypy treat ints as a subtype of floats. See: https://mail.python.org/pipermail/python-dev/2018-March/152384.html Open question: Is t