jpython: java.util.Enumeration & coersion (cast)?

Brian Zhou brian_zhouNOSPAM at agilent.com
Thu Nov 2 18:28:44 EST 2000


Hi,

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,

-Brian






More information about the Python-list mailing list