Python Variable Is Evaluated Differently In Pdb And Print Statements
I am using threads in a python program and recently found a problem where a float is not being interpreted correctly and whenever I go to print it out in pdb or in a logging statem
Solution 1:
Its pretty impossible to tell from what you've posted. Floats don't switch from 0.0 to ~0.05 randomly, something is changing the value stored in that memory location (variable). Are you setting the value from other thread?
Also, be aware that in your demo code, if you're looking for x.prob to have the value of 0.0592 from the beginning, it will fail the equality test in the if statement and never trigger your print statements.
Post a Comment for "Python Variable Is Evaluated Differently In Pdb And Print Statements"