B
bor
of no help, so just <snip> if you hate that sort of thing...
if 2 > '1' : print "greater"
else : print "less_or_equal"
prints less_or_equal
As it should, because the condition 2>'1' is not true..
Give a machine a conditional statement that doesn't return true, followed
by
an else... etc
Under most circumstances, python is fairly logical. In this case, too.
However...
class C:
def __init__(self): pass
X=C()
if 2 > X : print "greater"
prints greater
Now *here* I see exactly what you're saying.
I'd noticed this slight oddness too..
First example doesn't really exhibit the behaviour, but this one bothers
slightly. I'm not really on top of the technical stuff about python, but
I'd
had all sorts of obvious thoughts about this one like could the comparison
be taking
an instance to have 'no' numerical value ie 'none' when using some
particular comparison method?
I'd be interested to know this one myself...
=============================
M. Harris
Sr Developer
DNM, Inc.
if 2 > '1' : print "greater"
else : print "less_or_equal"
prints less_or_equal
As it should, because the condition 2>'1' is not true..
Give a machine a conditional statement that doesn't return true, followed
by
an else... etc
Under most circumstances, python is fairly logical. In this case, too.
However...
class C:
def __init__(self): pass
X=C()
if 2 > X : print "greater"
prints greater
Now *here* I see exactly what you're saying.
I'd noticed this slight oddness too..
First example doesn't really exhibit the behaviour, but this one bothers
slightly. I'm not really on top of the technical stuff about python, but
I'd
had all sorts of obvious thoughts about this one like could the comparison
be taking
an instance to have 'no' numerical value ie 'none' when using some
particular comparison method?
I'd be interested to know this one myself...
=============================
M. Harris
Sr Developer
DNM, Inc.