Hallo, Jaros?aw Zabie??o hat gesagt: // Jaros?aw Zabie??o wrote: > On Monady 2003-10-05 at 17:15:00 > Ian Bicking <[EMAIL PROTECTED]> wrote: > > >> if 0 < i < 100: ... > > > > This isn't proper Python, it's interpreted as (0 < i) < 100. > > No, you are wrong. It is interpreted as (0 < i ) and (i < 100) > > >>> i =-1 > >>> if 0 < i < 10: > ... print 'ok' > ... else: > ... print 'bad' > ...
Or (python 2.3): >>> 3 < 2 < 10 False >>> (3 < 2) < 10 True >>> 3 < (2 < 10) False I actually had this look up again, though. Too much C++ lately, but the docs say: Unlike C, all comparison operations in Python have the same priority, which is lower than that of any arithmetic, shifting or bitwise operation. Also unlike C, expressions like a < b < c have the interpretation that is conventional in mathematics: ... Comparisons can be chained arbitrarily, e.g., x < y <= z is equivalent to x < y and y <= z, except that y is evaluated only once (but in both cases z is not evaluated at all when x < y is found to be false). ciao -- Frank Barknecht _ ______footils.org__ ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss