Message32152
I am not really sure whether this is a bug or a feature.
The attached code attempts to demonstrate the problem.
I had some code that was trying to change -0.0 to 0.0 so that the accountants I work with don't panic.
The code was something like this:
if n == -0.0:
n = 0.0
Regardless of whether n is -0.0 or 0.0 the test passes (which is good).
However after the assignment n is actually -0.0
It looks like python is creating a single object for both -0.0 and 0.0.
Whichever appears first within the local scope seems to be the value that actually gets stored.
Eg changing the code to
if n == 0.0:
n = 0.0
gets me the behaviour I wanted. |
|
Date |
User |
Action |
Args |
2007-08-23 14:54:21 | admin | link | issue1729014 messages |
2007-08-23 14:54:21 | admin | create | |
|