On 02/26/2013 04:41 PM, Burak Arslan wrote:
On 02/26/13 17:26, azurIt wrote:
huh. i have no idea why it's not working. what could be different
between your setup and mine? what version of python is it? are you still
on python 2.5? my tests are done with 2.7.3 on x64 Linux. what about
you?

Ok, i found out that this is NOT related to lxml. No matter which lxml
version is install, it's not working under Python 2.6 (i have 2.6.6)
with rpclib/spyne >= 2.8.0. Always works with Python 2.7. Can you try
it with p2.6 please?

Whaat?! What kind of nonsense is this?

Python 2.6.8 (unknown, Feb 26 2013, 17:49:34)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> from decimal import Decimal
 >>> Decimal('Infinity') > 5
True
 >>> Decimal('Infinity') > 5.0
False
 >>>

Python 2.5 seems to get it right:

Python 2.5.4 (r254:67916, Feb  1 2013, 04:01:02)
[GCC 4.5.4] on linux3
Type "help", "copyright", "credits" or "license" for more information.
 >>> from decimal import Decimal
 >>> Decimal('Infinity') > 5
True
 >>> Decimal('Infinity') > 5.0
True
 >>>

Fixed for both in 2.9 and 2.10 in f1443cf2262fe24f10eab42826e774abdb9f56b3.

Azur, thanks for the bug report.

are you sure you want to go this route? back when i changed this to Decimal it was specifically to avoid these issues (as much as possible anyway):

https://github.com/arskom/spyne/pull/155

...i never tested arbitrary floats. it appears *all* Decimal objects compare as less than a float(). unfortunate.

floats are hardware dependent and unsuitable for *anything* that requires some notion of knowable accuracy -- my suggestion would be to wrap incoming Attribute values with a compat layer or something, at the expense of performance :( -- eg, convert incoming float -> str -> Decimal, or probably better, throw an exception (float() + Decimal() already throws, but Python has an [unwritten?] practice of "anything compares to anything" which is the only reason it's attempted at all)

...this is a known pain point AFAICT:

http://bugs.python.org/issue2531

...but at the end of the day, Decimal is the most suitable primitive IMO.

--

C Anthony

-----------------------------------------
CONFIDENTIALITY: The information contained in this communication may be 
confidential and is intended only for the use of the intended recipient(s). If 
the reader of this message is not the intended recipient(s), you are hereby 
notified that
any dissemination, distribution, or copying of this communication, or any of 
its contents, is strictly prohibited. If you have received this communication 
in error, please return it to the sender immediately and delete any copy of it 
from your computer system.
_______________________________________________
Soap mailing list
[email protected]
http://mail.python.org/mailman/listinfo/soap

Reply via email to