|
From: Kevin D. <kda...@we...> - 2001-09-17 16:09:18
|
This has a simple test case, but I'm not sure that the solution is simple.
Jython 2.1a3 on java1.3.0 (JIT: null)
Type "copyright", "credits" or "license" for more information.
>>> class Foo:
... mylistIndex = ['a', 'b', 'c', 'd', 'e'].index
...
>>> a = Foo()
>>> a.mylistIndex
<builtin method 'index'>
>>> a.mylistIndex('c')
Traceback (innermost last):
File "<console>", line 1, in ?
TypeError: index(): expected 1 args; got 2
>>>
>>> Foo.mylistIndex('c')
Traceback (innermost last):
File "<console>", line 1, in ?
java.lang.NullPointerException
at org.python.core.ListFunctions.__call__(PyList.java)
at org.python.core.PyObject.invoke(PyObject.java)
at org.python.pycode._pyx2.f$0(<console>:1)
at org.python.pycode._pyx2.call_function(<console>)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyCode.call(PyCode.java)
at org.python.core.Py.runCode(Py.java)
at org.python.core.Py.exec(Py.java)
at org.python.util.PythonInterpreter.exec(PythonInterpreter.java)
at
org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter
.java)
at
org.python.util.InteractiveInterpreter.runsource(InteractiveInterpret
er.java)
at
org.python.util.InteractiveInterpreter.runsource(InteractiveInterpret
er.java)
at org.python.util.InteractiveConsole.push(InteractiveConsole.java)
at
org.python.util.InteractiveConsole.interact(InteractiveConsole.java)
at org.python.util.jython.main(jython.java)
java.lang.NullPointerException: java.lang.NullPointerException
For reference, CPython doesn't choke on this:
Python 2.1 (#1, Apr 17 2001, 09:45:01)
[GCC 2.95.3-2 (cygwin special)] on cygwin_nt-4.01
Type "copyright", "credits" or "license" for more information.
>>> class Foo:
... mylistIndex = ['a', 'b', 'c', 'd', 'e'].index
...
>>> a = Foo()
>>> a.mylistIndex
<built-in method index of list object at 0xa04da34>
>>> a.mylistIndex('c')
2
>>>
|