Issue2064
Created on 2013-06-28.15:33:48 by wchang, last changed 2013-06-28.19:22:24 by pjenvey.
msg8053 (view) |
Author: wchang (wchang) |
Date: 2013-06-28.15:33:48 |
|
I'm using type to create an anonymous class using type() on jython 2.7
e.g.
>>> c = type("test_c1",(java.io.File,),{})
>>> isinstance(c,java.io.File)
False
>>> d=type("test_i1",(java.io.FilenameFilter,),{})
>>> isinstance(d,java.io.FilenameFilter)
False
|
msg8054 (view) |
Author: wchang (wchang) |
Date: 2013-06-28.15:36:12 |
|
I'm using type to create an anonymous class using type() on jython 2.7
However when I do the following it doesn't work.
e.g.
>>> c = type("test_c1",(java.io.File,),{})
>>> isinstance(c,java.io.File)
False
>>> d=type("test_i1",(java.io.FilenameFilter,),{})
>>> isinstance(d,java.io.FilenameFilter)
False
|
msg8055 (view) |
Author: Philip Jenvey (pjenvey) |
Date: 2013-06-28.19:22:24 |
|
your isinstance calls are checking against the *type* you've created. Your type 'c' is not an instance of java.io.File. However an actual instance of 'c' is (isinstance(c(), java.io.File) would be True).
c's only a subclass of File: i.e. issubclass(c, java.io.File)
|
|
Date |
User |
Action |
Args |
2013-06-28 19:22:24 | pjenvey | set | status: open -> closed resolution: invalid messages:
+ msg8055 nosy:
+ pjenvey |
2013-06-28 15:36:12 | wchang | set | messages:
+ msg8054 |
2013-06-28 15:33:48 | wchang | create | |
|