On 2010-03-30 12:11 PM, Steven D'Aprano wrote:
On Tue, 30 Mar 2010 10:08:31 -0700, John Nagle wrote:

Yes, Python has ternary operator-like syntax: return ('Yes' if a==b
else 'No')

Note that this requires a recent version of Python.

      Who let the dogs in?  That's awful syntax.

I used to think so to, but now I like it. It matches common English
syntax like:

"I'm going to the movies tonight, if I leave the office early, otherwise
I'll stay home and nitpick on Usenet."

I would suggest that this is much more common and less awkward English usage: "If I leave the office early, I'm going to the movies tonight; otherwise, I'll stay home and nitpick on Usenet."

I don't have a problem with the current syntax, and while its English analogue is grammatical, I don't think you can rightly call it idiomatic.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to