basic if stuff- testing ranges

Donn Ingle donn.ingle at gmail.com
Sun Nov 25 13:49:34 EST 2007


Sheesh, I've been going spare trying to find how to do this short-hand:
if 0 > x < 20: print "within"

So that x must be > 0 and < 20.

I usually do:
if x > 0 and x < 20: print "within"

What's the rule? Does it even exist?
I read something like it recently on the list but can't find it, that's
where I got the urge to try it from. I can't find anything in the docs, but
then again (imho) the Python docs are like a tangled jungle...


\d




More information about the Python-list mailing list