######### > > Interesting. So on Windows there's probably no > hope of what I want to do working. > But on a platform where the C library does the > right thing with signed zeros, this > behaviour is still a little surprising. I > guess what's happening is that there's > some optimization that avoids creating two > separate float objects for a float literal > that appears twice, and that optimization > doesn't see the difference between 0. and -0. > > >>> x, y = 0., -0. > >>> id(x) == id(y) > > True > > jim-on-linux's solution works in the > interpreter, but not in a script, presumably > because we've got file-wide optimization rather > than line-by-line optimization. > > #test.py > x = -0.0 > y = 0.0 > print x, y > #end test.py > > >>> import test > > -0.0 -0.0 > > Mark
This is the only way I could make this work in a script. from decimal import Decimal x = Decimal( "-0.0") y= Decimal("0.0") print x,y x = Decimal( "0.0") y= Decimal("-0.0") print x,y jim-on-linux http:\\www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list