version of compilation in syntax python

Messages in english

Modérateur : xcasadmin

compsystems
Messages : 562
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

version of compilation in syntax python

Message par compsystems » mar. mars 12, 2019 3:55 pm

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"

parisse
Messages : 5739
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: version of compilation in syntax python

Message par parisse » mar. mars 12, 2019 5:03 pm

Type python(f) to get it printed in Python syntax.

Répondre