This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author swfiua
Recipients
Date 2007-05-31.15:27:32
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
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.
History
Date User Action Args
2007-08-23 14:54:21adminlinkissue1729014 messages
2007-08-23 14:54:21admincreate