From: Kevin B. <kb...@ca...> - 2002-03-19 19:14:23
|
Brad Cox wrote: > Thanks. But """ doesn't work either.... This appears to be a bug in the parser in Jython's interactive interpreter: Jython 2.1 on java1.3.1_02 (JIT: null) Type "copyright", "credits" or "license" for more information. >>> """hello Traceback (innermost last): (no code object) at line 0 File "<console>", line 2 SyntaxError: Lexical error at line 2, column 0. Encountered: <EOF> after : "" >>> print """hello Traceback (innermost last): (no code object) at line 0 File "<console>", line 2 SyntaxError: Lexical error at line 2, column 0. Encountered: <EOF> after : "" >>> def go(): ... print """Hello Traceback (innermost last): (no code object) at line 0 File "<console>", line 3 SyntaxError: Lexical error at line 3, column 0. Encountered: <EOF> after : "" >>> ^Z In contrast, with CPython: PYTHON:/e/work/cp$ python Python 2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> """Hello ... world""" 'Hello\nworld' >>> ^Z If you create & execute a file, they both work identically: PYTHON:d:/temp$ cat >> hello.py print """Hello world""" PYTHON:d:/temp$ jython hello.py Hello world PYTHON:d:/temp$ python hello.py Hello world PYTHON:d:/temp$ kb |