Integer comparison in Python -


i came across odd. i'm kind of new python sorry if basics.

a = 12 b = int(24/3) x = (a < b) 

from debugger: have:

a (int) = 12 b (int) = 8 x (bool) = true 

so seems 8 > 12 in situation, i'm clueless here, explanation?

ps: x = < b same (without brackets)

edit i'm using squish (automatic tests), , seems that's issue asked colleagues test same snipet in squish , did same.

this well-known behaviour, though not intuitive, behaviour of squish. int call doesn't use python int function rather invokes int constructor constructing integer can passed methods in application under test (setwidth or so). i.e. squish overrides meaning of int.

you can use

import __builtin__ = 12 b = __builtin__.int(24/3) x = (a < b) 

to enforce getting python int.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -