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

Brian Zhou 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

"Brian Zhou" <brian_zhouNOSPAM at agilent.com> wrote in message
news:tUlM5.77$%73.385077 at nntp.labs.agilent.com...
> 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