baffling bug in this bit of code!

Max M maxm at mxm.dk
Wed Jul 3 09:33:00 EDT 2002


Daniel Jaeggi wrote:

>             if (y > max_y):
>                 print "updating max_y"
>                 max_y = y

> Why does max_x get located and not max_y? Or, more specifically, why 
> does max_y get correctly updated in the first iteration and not 
> subsequently?!

Are you shure you are not comparing apples and oranges here ???

erhh I mean strings and integers ...

Ie.

max_y = '8'
y = 42
if (y > max_y):
    etc.

Could be very confusing, and difficult to see in a printout.

Try repr() to see if this is the problem.

regards Max M




More information about the Python-list mailing list