1 | initial version |
Still not have time to learn Python ?
<value> if <condition> else <alternative value>
.No elif
, but that's not an hindrance (elif
is syntactic sugar anyway...).Example :
sage: [-1 if u<0 else 0 if u==0 else +1 for u in range(-2,3)]
[-1, -1, 0, 1, 1]
lambda
function is, by definition, anonymous, there is, as far as I can tell, no way to "cleany" have it call itself.There are some proposals to do this in contorted ways (amounting to recursively create, use and discard new anonymous functions), which I find difficult to understand in vivo and probably impossible to debug.
BTW, aping each and every Mathematica function is probably not a good way to learn Sage ; if you insist on modeling your code on a non-Python language, Lisp would be a much better example...