Re: Ternary Operator in Python

2005-04-02 Thread Steven Bethard
Scott David Daniels wrote: Roy Smith wrote: ... How our tools warp our thinking. That is what it means to be human. I can think of no better reason for a programmer to regularly learn languages: "our tools warp our thinking." A programmer is a professionally warped thinker. --Scott David Daniels

Re: Ternary Operator in Python

2005-04-02 Thread Scott David Daniels
Roy Smith wrote: ... How our tools warp our thinking. That is what it means to be human. I can think of no better reason for a programmer to regularly learn languages: "our tools warp our thinking." A programmer is a professionally warped thinker. --Scott David Daniels [EMAIL PROTECTED] -- http:

Re: Ternary Operator in Python

2005-04-02 Thread Sunnan
Robert Kern wrote: Sunnan wrote: (((0.0 < a) < 1.0) < b ) < 2.0 Go on. Try it with a bunch of different values. My bad. (Of course. The subexpressions must return booleans, not the largest number. It couldn't work any other way.) Egg on my face, and all that (figuratively speaking). Not used to

Re: Ternary Operator in Python

2005-04-01 Thread Robert Kern
Sunnan wrote: Terry Reedy wrote: Gee, what about 0.0 < a < 1.0 < b < 2.0? I see both as synthesized multinary operators, but your are right in that this combination does act differently than a+b+c. Is < really multinary in python? It looks binary to me, just like +. (a+b)+c (((0.0 < a) < 1.0) <

Re: Ternary Operator in Python

2005-04-01 Thread Sunnan
Terry Reedy wrote: Gee, what about 0.0 < a < 1.0 < b < 2.0? I see both as synthesized multinary operators, but your are right in that this combination does act differently than a+b+c. Is < really multinary in python? It looks binary to me, just like +. (a+b)+c (((0.0 < a) < 1.0) < b ) < 2.0 Sunn

Re: Ternary Operator in Python

2005-04-01 Thread gene . tani
o > > work with ternary operator in Python. I cannot > > find any ternary operator in Python. So Kindly > > clear my doubt regarding this > > There is no ternary operator in python. There are several idioms that can be > used to emulate one to a certain degree - but they ar

Re: Ternary Operator in Python

2005-04-01 Thread Carl Banks
Terry Reedy wrote: > "Carl Banks" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >> A unary operator has one operand; a binary operator has two operands; > >> ternary operator has three operands. Python has none built-in, > > > > Not so fast, my friend. What about the expression

Re: Ternary Operator in Python

2005-04-01 Thread Roy Smith
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 wa

Re: Ternary Operator in Python

2005-04-01 Thread Terry Reedy
"Carl Banks" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> A unary operator has one operand; a binary operator has two operands; >> ternary operator has three operands. Python has none built-in, > > Not so fast, my friend. What about the expression "0.0 < a < 1.0"? Gee, what a

Re: Ternary Operator in Python

2005-04-01 Thread Carl Banks
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

Re: Ternary Operator in Python

2005-04-01 Thread Erik Max Francis
Ron_Adam wrote: I've used boolean opperations to do it. result = (v == value) * first + (v != value) * second Same as: if v == value: result = first else: result = second No, it isn't, because it isn't short circuiting. If first or second had side effects, then the two would not be equiv

Re: Ternary Operator in Python

2005-04-01 Thread Terry Reedy
"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

Re: Ternary Operator in Python

2005-04-01 Thread Ron_Adam
On Fri, 1 Apr 2005 08:24:42 +0100 (BST), praba kar <[EMAIL PROTECTED]> wrote: >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

Re: Ternary Operator in Python

2005-04-01 Thread Scott David Daniels
John Roth 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 Ther

Re: Ternary Operator in Python

2005-04-01 Thread Diez B. Roggisch
praba kar wrote: > 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 There is no ternary operator in python. There are several idioms that

Re: Ternary Operator in Python

2005-04-01 Thread John Roth
"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 There isn't one, a

Re: Ternary Operator in Python

2005-04-01 Thread Roy Smith
praba kar <[EMAIL PROTECTED]> wrote: > 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. You answered your own question; there is no ternary operator in Python. There was a ma

Re: Ternary Operator in Python

2005-04-01 Thread Sean Kemplay
On Apr 1, 2005 8:10 PM, Erik Max Francis <[EMAIL PROTECTED]> wrote: > Sean Kemplay wrote: > > > You could use > > > > condition and consequent or alternative > > > > I use it > > You should do so cautiously, since if consequent is false, it will not > behave as suspected. Not to mention that it'

Re: Ternary Operator in Python

2005-04-01 Thread Erik Max Francis
Sean Kemplay wrote: You could use condition and consequent or alternative I use it You should do so cautiously, since if consequent is false, it will not behave as suspected. Not to mention that it's quite unreadable. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San

Re: Ternary Operator in Python

2005-04-01 Thread Steven Bethard
praba kar wrote: 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. http://www.python.org/peps/pep-0308.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Ternary Operator in Python

2005-04-01 Thread Sean Kemplay
You could use condition and consequent or alternative I use it Sean On Apr 1, 2005 5:24 PM, praba kar <[EMAIL PROTECTED]> wrote: > 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

Ternary Operator in Python

2005-03-31 Thread praba kar
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 With regards, Prabahar __ Do you Yahoo!? Yahoo! Mail - Helps

Ternary Operator in Python

2005-03-31 Thread praba kar
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 __ Yahoo! Messenger Show us what our next emoticon should look