Message313707
As for StackOverflow links provided by Robert, it looks to me that float.is_integer() is always used improperly.
If keep this method it would be worth to warn against improper use of it.
Bad:
(x/5).is_integer()
Good:
x % 5 == 0
or
not x % 5
Bad:
math.sqrt(x).is_integer()
Good:
int(math.sqrt(x))**2 == x
Bad:
while x < y:
if x.is_integer():
print(x)
x += 0.1
Good (if initial x was integer):
x0 = x
i = 0
while x < y:
x = x0 + i/10
if not i % 10:
print(x)
i += 1
And provide an example of a *proper* use case (if it exists). |
|
Date |
User |
Action |
Args |
2018-03-12 22:26:51 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, tim.peters, rhettinger, facundobatista, mark.dickinson, christian.heimes, skrah, robert_smallshire, Austin Bingham |
2018-03-12 22:26:51 | serhiy.storchaka | set | messageid: <1520893611.36.0.467229070634.issue26680@psf.upfronthosting.co.za> |
2018-03-12 22:26:51 | serhiy.storchaka | link | issue26680 messages |
2018-03-12 22:26:51 | serhiy.storchaka | create | |
|