How on Factorial

Steven D'Aprano steve-REMOVE-THIS at cybersource.com.au
Mon Nov 1 04:43:44 EDT 2010


On Mon, 01 Nov 2010 20:23:42 +1300, Lawrence D'Oliveiro wrote:

> In message <qoteibcq9pr.fsf at ruuvi.it.helsinki.fi>, Jussi Piitulainen
> wrote:
> 
>> (I agree that no one should write factorial like that, except as a
>> joke. I have nothing against (x if (a > b) else y). The trick with and
>> and or was used before Python had an actual conditional expression.)
> 
> You know what, I think I actually prefer the trick to Python’s
> backwards-if syntax...

What backwards-if syntax? I tried writing it backwards:

true_clause fi condition esle false_clause

and got a syntax error, so I tried writing it backwards another way:

false_clause else condition if true_clause 

and still got a syntax error, so I can only conclude that you're using 
some hacked version of Python with non-standard syntax, if you're 
serious, else you're unaware that Python's ternary if operator follows 
English syntax.


-- 
Steven



More information about the Python-list mailing list