From: Ype K. <yk...@xs...> - 2002-02-10 11:10:22
|
Dirk, >Hello, > >I have noticed a strange behavior of Jython. Coming from CPython I run >into this problem and I'm not sure if it was pure luck that this worked >for me so far, or if jython has a bug. > >Consider the following program: > >class c: > def m(self): > pass > >i = c() > >d = {} > >d[i.m] = 42 >d[i.m] = 23 >print d > >This yields, not very suprising, this result with CPython 2.1.1: >dirk@susi:~/python> python test.py >{<method c.m of c instance at 0x80e6394>: 23} > >With Jython 2.1 and Sun Java2 1.4rc1 however: >dirk@susi:~/python> ../jython-2.1/jython test.py >{<method c.m of c instance at 16348303>: 23, <method c.m of c instance >at 16348303>: 42} > >Well, this caught me rather off-guard and I debug quite a while. I would >be extremely happy I anybody could explain this to me. I'm quite unsure >how Python or Jython compare methods anyway. I think this is a bug in jython: the same method instance can occur multiple times as a key in a dictionary. I'd recommend to file the original message as a bug report on jython.sourceforge.net. Regards, Ype -- |