[Python-Dev] [RELEASE] Python 3.6.5rc1 is now available for testing

2018-03-13 Thread Ned Deily
Announcing the immediate availability of Python 3.6.5 release candidate 1! Python 3.6.5rc1 is the first release candidate for Python 3.6.5, the next maintenance release of Python 3.6. While 3.6.5rc1 is a preview release and, thus, not intended for production environments, we encourage you to

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

2018-03-13 Thread Tim Peters
[Tim] >> An obvious way to extend it is for Fraction() to look for a special >> method too, say "_as_integer_ratio()". [Greg Ewing] > Why not __as_integer_ratio__? Because. at this point, that would be beating a dead horse ;-) ___ Python-Dev mailing

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

2018-03-13 Thread Greg Ewing
Tim Peters wrote: An obvious way to extend it is for Fraction() to look for a special method too, say "_as_integer_ratio()". Why not __as_integer_ratio__? -- Greg ___ Python-Dev mailing list Python-Dev@python.org

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

2018-03-13 Thread Raymond Hettinger
> On Mar 13, 2018, at 12:07 PM, Guido van Rossum wrote: > > OK, please make it so. Will do. I'll create a tracker issue right away. Since this one looks easy (as many things do at first), I would like to assign it to Nofar Schnider (one of my mentees). Raymond > > On

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

2018-03-13 Thread Guido van Rossum
OK, please make it so. On Tue, Mar 13, 2018 at 11:39 AM, Raymond Hettinger < raymond.hettin...@gmail.com> wrote: > > > > On Mar 13, 2018, at 10:43 AM, Guido van Rossum wrote: > > > > So let's make as_integer_ratio() the standard protocol for "how to make > a Fraction out of a

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

2018-03-13 Thread Raymond Hettinger
> On Mar 13, 2018, at 10:43 AM, Guido van Rossum wrote: > > So let's make as_integer_ratio() the standard protocol for "how to make a > Fraction out of a number that doesn't implement numbers.Rational". We already > have two examples of this (float and Decimal) and perhaps

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

2018-03-13 Thread Tim Peters
[Guido] > So let's make as_integer_ratio() the standard protocol for "how to make a > Fraction out of a number that doesn't implement numbers.Rational". We > already have two examples of this (float and Decimal) and perhaps numpy or > the sometimes proposed fixed-width decimal type can benefit

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

2018-03-13 Thread Guido van Rossum
So let's make as_integer_ratio() the standard protocol for "how to make a Fraction out of a number that doesn't implement numbers.Rational". We already have two examples of this (float and Decimal) and perhaps numpy or the sometimes proposed fixed-width decimal type can benefit from it too. If

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

2018-03-13 Thread Tim Peters
[Tim] >> At heart, the Fraction() constructor is _all about_ creating integer >> ratios, so is the most natural place to put knowledge of how to do so. >> A protocol for allowing new numeric types to get converted to Fraction >> would be more generally useful than just a weird method only datetime

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

2018-03-13 Thread Guido van Rossum
On Mon, Mar 12, 2018 at 10:01 PM, Tim Peters wrote: > At heart, the Fraction() constructor is _all about_ creating integer > ratios, so is the most natural place to put knowledge of how to do so. > A protocol for allowing new numeric types to get converted to Fraction >

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

2018-03-13 Thread Steven D'Aprano
On Mon, Mar 12, 2018 at 09:49:27AM -0700, Raymond Hettinger wrote: > * We already have a simple, traditional, portable, and readable way to > make the test: int(x) == x Alas, the simple way is not always the correct way: py> x = float('inf') py> x == int(x) Traceback (most recent call last):

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

2018-03-13 Thread Mark Dickinson
On Mon, Mar 12, 2018 at 9: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. > Looks like it

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

2018-03-13 Thread Serhiy Storchaka
13.03.18 10:35, Larry Hastings пише: On 03/12/2018 08:41 PM, Guido van Rossum wrote: If you force me to choose between allowing hex(3.14) or 42.hex() I'll choose the latter I assume you meant (42).hex() here.  If you're also interested in changing the language to permit 42.hex(), well, color

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

2018-03-13 Thread Larry Hastings
On 03/12/2018 08:41 PM, Guido van Rossum wrote: If you force me to choose between allowing hex(3.14) or 42.hex() I'll choose the latter I assume you meant (42).hex() here.  If you're also interested in changing the language to permit 42.hex(), well, color me shocked :D (For those who