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 haven
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
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 snuck into the float type a
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):
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
> would be more generally us
[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
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
this
[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 from
> 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 numpy or the
> som
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 number that doesn't
> 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 Tue, Mar 13, 2018
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
https://mail.python.org/mailman/list
[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 lis
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 expl
14 matches
Mail list logo