Ben Bacarisse writes: > Jussi Piitulainen writes: > >> BartC writes: >> >>> On 17/08/2016 07:39, Steven D'Aprano wrote: >>>> Rather than ask why Python uses `trueval if cond else falseval`, you >>>> should ask why C uses `cond ? trueval : falseval`. Is that documented >>>> anywhere? >>> >>> I'm not fond of C's a ? b : c but the principle is sound. I generally >> >> [- -] >> >>> Anyway a?b:c was existing practice. At least the order of a,b,c could >>> have been retained if not the exact syntax. >> >> The original was (c1 -> e1, c2 -> e2, ..., cn -> en) in John McCarthy's >> 1960 paper on symbolic expressions, with an actual arrow glyph in place >> of hyphen-greater-than. > > And BCPL (Martin Richards 1967) took the same arrow and comma syntax. > BCPL spawned B which led to C, but in B Thompson used ? and : but kept > the right-to-left binding. I think the change was unfortunate because > the arrow works well in various layouts and looks much better when > chained (though that might just be my bias from being a BCPL coder from > way back). > > <snip>
I share the preference but have never programmed in a language that uses an arrow syntax. Much thanks for the history. (To MRAB, too.) -- https://mail.python.org/mailman/listinfo/python-list