jpython: java.util.Enumeration & coersion (cast)?
brian_zhouNOSPAM at agilent.com
Fri Nov 3 06:51:03 CET 2000
Never mind. No need to cast (too used to strong typing).
The error was caused by a class mismatch.
"Brian Zhou" <brian_zhouNOSPAM at agilent.com> wrote in message
news:tUlM5.77$%73.385077 at nntp.labs.agilent.com...
> I want to iterate thru a java 1.1 collection:
> e = collection.elements()
> while e.hasMoreElements():
> elem = e.nextElement()
> here elem (org.python.core.PyNone) needs to be cast as SubClass instance.
> How do I do that? I've tried
> elem = SubClass(e.nextElement())
> but got error message:
> TypeError: pkg.SubClass(): 1st arg can't be coerced to short
> Thanks in advance,
More information about the Python-list