[issue11221] all() returns wrong result when the parameters are non-encapsulated list-comprehension

Jonathan Livni report at bugs.python.org
Wed Feb 16 09:47:54 CET 2011


Jonathan Livni <jonathan.livni at gmail.com> added the comment:

The exact list of decimals doesn't help - I tried taking the list and reproducing the bug with the following short script, but the problem did not reproduced:

from decimal import Decimal
L = [Decimal('6.700'), Decimal('6.800'), Decimal('7.140'), Decimal('7.460'), Decimal('7.735'), Decimal('8.160'), Decimal('8.280'), Decimal('8.355'), Decimal('8.710'), Decimal('9.640'), Decimal('10.155'), Decimal('10.460'), Decimal('10.810'), Decimal('11.875'), Decimal('12.310'), Decimal('12.315'), Decimal('13.250'), Decimal('13.205'), Decimal('13.750'), Decimal('14.245'), Decimal('14.805'), Decimal('15.385'), Decimal('15.955'), Decimal('16.365'), Decimal('16.960'), Decimal('17.500'), Decimal('19.445')]
print all(x<=y for x, y in zip(L, L[1:]))

The script above rightfully printed False.
The decimal list above was taken from the pydev debugger session where I found the bug.

In the original script I do not mess around with Decimal at all. I just cast too and from float and use simple arithmetics with it.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11221>
_______________________________________


More information about the Python-bugs-list mailing list