Page 1 sur 1

version of compilation in syntax python

Publié : mar. mars 12, 2019 3:55 pm
par compsystems
Hello

A program in Xcas mode, returns the rewritten version of compilation, but in syntax python no, I think it is important to also show the rewritten version of python syntax, in order to detect possible coding errors.

Xcas mode

Code : Tout sélectionner

f(x):={
  return x*x;
}
[enter]
(x)->[return(x*x)]

syntax python

Code : Tout sélectionner

def f(x):
    return x*x
[enter]
"Done"

The two points followed by ; at the end it should be interpreted in python syntax as not showing rewritten version of code

Code : Tout sélectionner

def f(x):
    return x*x
:;
[enter]
"Done"

Re: version of compilation in syntax python

Publié : mar. mars 12, 2019 5:03 pm
par parisse
Type python(f) to get it printed in Python syntax.