|
From: Robert W. B. <rb...@di...> - 2001-03-27 20:37:56
|
Hi all,
I've ran into a bit of confusion with the id() of characters in
Jython compared with Python. Here's something similar to the code
that started the confusion:
----------------------------------------------------------
S = "abc"
L = ["a", "b", "c"]
LoL = [L, L, L]
stringtest = S[1]
listtest = L[1]
loltest = LoL[1]
def test(obj1, obj2):
if ( id(obj1) != id(obj2) ):
return 0
assert(test(loltest, LoL[1])), "List-of-lists test failed"
assert(test(listtest, L[1])), "List test failed"
assert(test(stringtest, S[1])), "String test failed"
----------------------------------------------------------
In CPython, all passes, but in Jython, there's always an AE:
String test failed. Is this expected? unavoidable?
Tnx
-Robert
|