[Pythonmac-SIG] Baffling if statement

Kirk Durston kdurston at uoguelph.ca
Thu Sep 22 21:34:52 CEST 2005


After spending a couple hours trying to figure out what is going on, I¹m
asking for help.

Below is a short segment from a module I¹ve written. Before the part shown
below, temp and Cutoff are defined. then comes the following:

            blank='-'
            if temp>Cutoff:
                print 'temp is', temp
                print 'cutoff is', Cutoff
                print 'symbol is', symbol
                InfoCollector.append(symbol)
            else:InfoCollector.append(blank)

the print out shows that temp=0.261 and Cutoff is 0.29498. Clearly temp is
smaller than Cutoff, so it should have gone to Œelse:¹ but it didn¹t. In
fact, no matter if temp is larger or smaller than Cutoff, it always goes
through the Œif¹ segment.

If I change the sign to Œ<Œ, then it always goes to the Œelse¹ regardless of
the values of temp and Cutoff and never goes through the Œif¹ segment.

When I write a short program to try to duplicate the problem everything
works normally.

Baffled,

Kirk


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20050922/d684eb4c/attachment.htm


More information about the Pythonmac-SIG mailing list