From: Philip C. <Phil.Cannata@Sun.COM> - 2009-12-30 21:08:12
|
Yes, but if I put it in Python.g at line 639 as follows: //expr_stmt: testlist (augassign (yield_expr|testlist) | // ('=' (yield_expr|testlist))*) expr_stmt @init { stmt stype = null; } @after { if (stype != null) { $expr_stmt.tree = stype; } System.out.println("Value of a is " + PythonInterpreter.get("a", Number.class)); } I get compile: [javac] Compiling 600 source files to c:\My jython2.5.1\build\classes [javac] c:\My jython2.5.1\build\gensrc\org\python\antlr\PythonParser.java:4005: non-static method <T>get(java.lang.String,java.lang.Class<T>) cannot be referenced from a static context [javac] System.out.println("Value of a is " + PythonInterpreter.get("a", Number.class)); [javac] ^ and I'm not sure of a proper way to fix this. thanks phil At 02:28 PM 12/30/2009, Marc Downie wrote: >On Wed, Dec 30, 2009 at 2:18 PM, Philip Cannata ><<mailto:Phi...@su...>Phi...@su...> wrote: >Yes, in my original question to you (not to the email group) I was >essentially asking how to get "run time" values of variables that >have already been set by an assignment. Essentially I'd like a java >way to do this something like: > >>> a = 111 >and then do getValue(a) in some internal java code. > > >Are you looking for PythonInterpreter.get("a", Number.class) ? > >Marc. |