Robert Smallshire added the comment:
Yes Raymond, I can prepare a new PR as soon as the faulty PR has been rolled
back.
--
___
Python tracker
<https://bugs.python.org/issue26
Robert Smallshire added the comment:
First, I would like to apologise for the confusion I have inadvertently caused.
I didn't see Raymond's question and Guido's clear response here about not
modifying the numeric tower, as it came _long_ after activity had moved to
GitHub, an
Robert Smallshire added the comment:
> * no forward movement for a year and half
For most of that year and a half my pull-request was sitting in Github
<https://github.com/python/cpython/pull/6121> awaiting review by two core devs,
of which you Raymond, were one. I don't
Robert Smallshire added the comment:
Serhiy, you asked for use cases, not uses. The former can exist without the
latter. Use cases for is_integer() include all existing uses of x == int(x),
or other less obvious means of detecting integer values.
Folks try to use x.is_integer(), discover it
Robert Smallshire added the comment:
Python in effect contains an example itself. The math.factorial(x) function
contains what is in-effect an is_integer() check as a guard.
--
___
Python tracker
<https://bugs.python.org/issue26
Change by Robert Smallshire :
--
pull_requests: +5885
stage: needs patch -> patch review
___
Python tracker
<https://bugs.python.org/issue26680>
___
___
Python-
Robert Smallshire added the comment:
Thank you Raymond. I'll work up a PR shortly.
--
___
Python tracker
<https://bugs.python.org/issue26680>
___
___
Pytho
Robert Smallshire added the comment:
Apologies for the email splurge. That's the first and last time I'll use the
email interface to bugs.python.org.
--
___
Python tracker
<https://bugs.python.o
Robert Smallshire added the comment:
To respond to Raymond's points:
1) Nobody is suggesting that every float method should also be available on
int. Clearly some methods on float are not applicable to int.
2) Taken narrowly, you're right that is_integer() does nothing usef
Robert Smallshire added the comment:
I've recently run into this issue impeding duck-typing between int and float
again, when used in conjunction the int.__pow__, which may variously return an
int or float depending on the value - not the type - of the arguments.
This is succi
New submission from Robert Smallshire:
The documentation for the int(x) constructor explains that if possible, it
delegates to x.__int__(). The documentation does not explain that there is a
fallback to x.__trunc__() if x.__int__() is not available.
The only mention of __trunc__ in the
Robert Smallshire added the comment:
Thanks Stefan for the illuminating example.
I knew I shouldn't have strayed off-topic.
--
___
Python tracker
<http://bugs.python.org/is
Robert Smallshire added the comment:
>> Were float to inherit from Rational, rather than Real ...
> This would break the Liskov substitution principle.
How so? Rational extends Real with only numerator, denominator and __float__.
Isn't the existence of float.as_integer_ratio
Robert Smallshire added the comment:
Java makes no claim to have a numeric tower. Amongst the dynamic languages I
surveyed Matlab (isinteger), Javascript ES6 (isInteger), PHP (is_integer), R
(is.integer), TCL (is entier), and as we have seen Scheme (integer?) all have
methods for testing for
Robert Smallshire added the comment:
To be clear, I'm not arguing that is_integer is in the same category as hex and
fromhex; is_integer is a mathematical property of the number, whereas hex and
from hex are representational. Nobody expects interoperability of string
representations o
Robert Smallshire added the comment:
As for whether the shortcut float.is_integer(x) was needed, it has different
behavior to x==int(x) when x is either NaN or an infinity. We must even deal
with two different exception types OverflowError or ValueError respectively for
these two values on
Robert Smallshire added the comment:
Adding the second patch file.
--
Added file: http://bugs.python.org/file42336/is_integer_decimal.patch
___
Python tracker
<http://bugs.python.org/issue26
New submission from Robert Smallshire:
When the useful float.is_integer method was added the opportunity was missed to
incorporate this method into the numeric tower defined in numbers.py. This
increased the API distance between different number types, making them less
substitutable than
Changes by Robert Smallshire :
--
type: -> behavior
___
Python tracker
<http://bugs.python.org/issue26663>
___
___
Python-bugs-list mailing list
Unsubscrib
New submission from Robert Smallshire:
Note: This report is based on a close reading of the asyncio code, rather than
having experienced defective behaviour in test or production.
The documentation for BaseTransport.close() states: "Close the transport. If
the transport has a buffe
20 matches
Mail list logo