Title: Baffling if statement
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

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to