Re: [Python-Dev] Python 2.7 -- bugfix or security before EOL?

2018-03-12 Thread Benjamin Peterson
Sounds good to me. I've updated the PEP to say 2.7 is completely dead on Jan 1 2020. The final release may not literally be on January 1st, but we certainly don't want to support 2.7 through all of 2020. On Sat, Mar 10, 2018, at 18:54, Guido van Rossum wrote: > Let's not play games with

Re: [Python-Dev] Python 2.7 -- bugfix or security before EOL?

2018-03-12 Thread Nick Coghlan
On 11 March 2018 at 11:54, Guido van Rossum wrote: > Let's not play games with semantics. The way I see the situation for 2.7 > is that EOL is January 1st, 2020, and there will be no updates, not even > source-only security patches, after that date. Support (from the core devs,

Re: [Python-Dev] Symmetry arguments for API expansion

2018-03-12 Thread Serhiy Storchaka
12.03.18 18:49, Raymond Hettinger пише: There is a feature request and patch to propagate the float.is_integer() API through rest of the numeric types ( https://bugs.python.org/issue26680 ). While I don't think it is a good idea, the OP has been persistent and wants his patch to go forward.

Re: [Python-Dev] Python 2.7 -- bugfix or security before EOL?

2018-03-12 Thread Matěj Cepl
On 2018-03-12, 13:13 GMT, Nick Coghlan wrote: > +1 from me, as even if commercial redistributors do decide > they want to collaborate on a post-2020 Python 2.7 maintenance > branch, there's no technical reason that that needs to live > under the "python" GitHub organisation, and some solid >

Re: [Python-Dev] Symmetry arguments for API expansion

2018-03-12 Thread Paul Moore
On 12 March 2018 at 17:59, Serhiy Storchaka wrote: > 12.03.18 18:49, Raymond Hettinger пише: >> >> There is a feature request and patch to propagate the float.is_integer() >> API through rest of the numeric types ( https://bugs.python.org/issue26680 >> ). >> >> While I don't

Re: [Python-Dev] Symmetry arguments for API expansion

2018-03-12 Thread Antoine Pitrou
On Mon, 12 Mar 2018 09:49:27 -0700 Raymond Hettinger wrote: > > Starting point: Do we need this? > * We already have a simple, traditional, portable, and readable way to make > the test: int(x) == x It doesn't look that obvious to me. As a reviewer I would

Re: [Python-Dev] Symmetry arguments for API expansion

2018-03-12 Thread Mark Dickinson
On Mon, Mar 12, 2018 at 4:49 PM, Raymond Hettinger < raymond.hettin...@gmail.com> wrote: > What is the proposal? > * Add an is_integer() method to int(), Decimal(), Fraction(), and Real(). > Modify Rational() to provide a default implementation. > >From the issue discussion, it sounds to me as

Re: [Python-Dev] Symmetry arguments for API expansion

2018-03-12 Thread Guido van Rossum
There's a reason why adding this to int feels right to me. In mypy we treat int as a sub*type* of float, even though technically it isn't a sub*class*. The absence of an is_integer() method on int means that this code has a bug that mypy doesn't catch: def f(x: float): if x.is_integer():

Re: [Python-Dev] Symmetry arguments for API expansion

2018-03-12 Thread Gregory P. Smith
On Mon, Mar 12, 2018 at 9:51 AM Raymond Hettinger < raymond.hettin...@gmail.com> wrote: > There is a feature request and patch to propagate the float.is_integer() > API through rest of the numeric types ( https://bugs.python.org/issue26680 > ). > > While I don't think it is a good idea, the OP

Re: [Python-Dev] Symmetry arguments for API expansion

2018-03-12 Thread Raymond Hettinger
> On Mar 12, 2018, at 12:15 PM, Guido van Rossum wrote: > > There's a reason why adding this to int feels right to me. In mypy we treat > int as a sub*type* of float, even though technically it isn't a sub*class*. > The absence of an is_integer() method on int means that

Re: [Python-Dev] Symmetry arguments for API expansion

2018-03-12 Thread Serhiy Storchaka
12.03.18 21:15, Guido van Rossum пише: There's a reason why adding this to int feels right to me. In mypy we treat int as a sub*type* of float, even though technically it isn't a sub*class*.. The absence of an is_integer() method on int means that this code has a bug that mypy doesn't catch:

[Python-Dev] Symmetry arguments for API expansion

2018-03-12 Thread Raymond Hettinger
There is a feature request and patch to propagate the float.is_integer() API through rest of the numeric types ( https://bugs.python.org/issue26680 ). While I don't think it is a good idea, the OP has been persistent and wants his patch to go forward. It may be worthwhile to discuss on this

Re: [Python-Dev] Symmetry arguments for API expansion

2018-03-12 Thread Tim Peters
[Tim. on as_integer_ratio()] >> - I expect the audience is tiny. [Alexander Belopolsky] > The datetime module would benefit from having as_integer_ratio() > supported by more types. It's been hard to resist requests to allow > Decimal in timedelta constructors and/or arithmetics I don't see the

Re: [Python-Dev] Symmetry arguments for API expansion

2018-03-12 Thread Tim Peters
[Tim Peters] >> ... >> >>> (-math.inf) ** 3.1 >> inf [David Mertz] > Weird. I take it that's what IEEE-754 says. NaN would sure be more intuitive > here since inf+inf-j is not in the domain of Reals. Well, technically > neither is inf, but at least it's the limit of the domain. :-). Mathematical

Re: [Python-Dev] Symmetry arguments for API expansion

2018-03-12 Thread Tim Peters
[David Mertz ] > ... > I can see no sane reason why anyone would ever call float.is_integer() > actually. That should always be spelled math.isclose(x, int(x)) because > IEEE-754. Attractive nuisance is probably too generous, I'd simply call the > method a bug. Sometimes it's

Re: [Python-Dev] Symmetry arguments for API expansion

2018-03-12 Thread Alexander Belopolsky
On Mon, Mar 12, 2018 at 5:18 PM, Tim Peters wrote: > [Guido] >> as_integer_ratio() seems mostly cute (it has Tim Peters all >> over it), > > Nope! I had nothing to do with it. I would have been -0.5 on adding > it had I been aware at the time. > > - I expect the

Re: [Python-Dev] Symmetry arguments for API expansion

2018-03-12 Thread David Mertz
If anyone cares, my vote is to rip out both .as_integer_ratio() and .is_integer() from Python. I've never used either and wouldn't want to. Both seem like perfectly good functions for the `math` module, albeit the former is simply the Fraction() constructor. I can see no sane reason why anyone

Re: [Python-Dev] Symmetry arguments for API expansion

2018-03-12 Thread David Mertz
On Mon, Mar 12, 2018, 3:25 PM Tim Peters wrote: > [David Mertz ] > > ... > > I can see no sane reason why anyone would ever call float.is_integer() > > actually. That should always be spelled math.isclose(x, int(x)) because > > IEEE-754. Attractive nuisance

Re: [Python-Dev] Symmetry arguments for API expansion

2018-03-12 Thread Guido van Rossum
On Mon, Mar 12, 2018 at 1:03 PM, Raymond Hettinger < raymond.hettin...@gmail.com> wrote: > > > On Mar 12, 2018, at 12:15 PM, Guido van Rossum wrote: > > > > There's a reason why adding this to int feels right to me. In mypy we > treat int as a sub*type* of float, even though

Re: [Python-Dev] Symmetry arguments for API expansion

2018-03-12 Thread Tim Peters
[Guido] > as_integer_ratio() seems mostly cute (it has Tim Peters all > over it), Nope! I had nothing to do with it. I would have been -0.5 on adding it had I been aware at the time. - I expect the audience is tiny. - While, ya, _I_ have uses for it, I had a utility function for it