need help regarding compilation



i am new to learning jython...


i just tried compiling a small piece of code that is given below:

def fac(x)
if x<=1:return 1
return x*fac(x-1)

on

C:\Program Files\jython\temp>jythonc factor.py

it showed the following error:

processing factor
Traceback (innermost last):
File "C:\Program Files\jython\Tools\jythonc\jythonc.py", line 5, in ?
File "C:\Program Files\jython\Tools\jythonc\main.py", line 298, in
main
File "C:\Program Files\jython\Tools\jythonc\main.py", line 219, in
doCompile
File "C:\Program Files\jython\Tools\jythonc\compile.py", line 195, in
compilef
ile
File "C:\Program Files\jython\Tools\jythonc\compile.py", line 209, in
compile
File "C:\Program Files\jython\Tools\jythonc\SrcGenCompiler.py", line
1079, in
execstring
File "<string>", line 1
def fac(x)
^
SyntaxError: invalid syntax





What may have gone wrong?
I am totally clueless as it is not mentioned in any of the books that I
tried.

.



Relevant Pages

  • Re: changing local namespace of a function
    ... >> Exec is slow since compiling the string and calls to globalsuse a ... def makeFunction: ... exec code in d ... You are still including the compile overhead in fun2. ...
    (comp.lang.python)
  • Re: need help regarding compilation
    ... i just tried compiling a small piece of code that is given below: ... This is invalid Python syntax. ... The problem is that "def" statements must be followed with a colon, ...
    (comp.lang.python)
  • Re: multiple inheritance
    ... is this a 'feature' of the language or its actual ... > def foo: ...
    (comp.lang.python)
  • Re: need help regarding compilation
    ... i just tried compiling a small piece of code that is given below: ... def fac ... definitions are closed by a colon? ...
    (comp.lang.python)
  • Re: self-building intelligence
    ... For the real-time high-dimension learning problems I've always been ... I talk of something like "compiling" because I don't see the ... I have never found a learning problem where the speed of the algorithm ... average against the set of all possible cost functions. ...
    (comp.ai.philosophy)