In article <[EMAIL PROTECTED]>, "Carl Banks" <[EMAIL PROTECTED]> wrote:
> Terry Reedy wrote: > > "praba kar" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > Dear All, > > > I am new to Python. I want to know how to > > > work with ternary operator in Python. I cannot > > > find any ternary operator in Python. So Kindly > > > clear my doubt regarding this > > > > A unary operator has one operand; a binary operator has two operands; > a > > ternary operator has three operands. Python has none built-in, > > Not so fast, my friend. What about the expression "0.0 < a < 1.0"? I still remember one of the earliest bugs I ever wrote (I've long since forgotten most of the zillions I've written since). It must have been around 1975, and my high school had an ASR-33 connected to a HP-3000 running Time Shared Basic at another school a few towns away. I wrote something like "1 < X < 10" and got an error. I was puzzled by this, since we were using this notation in math class. The answer of course was that I needed to write "1 < X AND X < 10", which I found really annoying and strange looking. Or is my long-term memory returning corrupted data? Maybe BASIC let you do 1 < X < 10, but I ran into this when I moved onto FORTRAN the next year? In any case, I've gotten so used to writing 1 < x && x < 10 (or variations on the theme) that now I've got a language which lets me write it the normal math way, 1 < x < 10, and *that* looks strange. Wierd, huh? How our tools warp our thinking. -- http://mail.python.org/mailman/listinfo/python-list