D-Man,
thanks -- after I posted my message I realised I was suffering from a
caffeine-inadequacy -- JYthon is, of course, doing _exactly_ the right thing
and my brain was fogged. Makes you wonder:
Should one think of Jython as a turbo/typeless-java
Should one think of Jython as Python with escape hatches to Java
Should one think of Jython as Jython and forget its origins
I suspect some of my confusion (and some others I have seen on the mailing
list) come from the
Jython/Python/Java overlap.
Thanks again
Alanl
-----Original Message-----
From: jyt...@li...
[mailto:jyt...@li...]On Behalf Of D-Man
Sent: Wednesday, July 18, 2001 11:40 AM
To: Jython-users
Subject: Re: [Jython-users] Class casting ....
On Wed, Jul 18, 2001 at 10:33:14AM -0700, Alan Littleford wrote:
| Now, of course, in Java I can setJ(p) and cast: (P)getJ() to get a
| P back.
Yes, this ugly hack is required to work around the static type
checking.
| In Jython however I always get a J back from getJ() and I
| would seem to have no way of 'casting' it up to my Python subclass.
Jython uses dynamic typing just like CPython so if you really have
something that is of type 'P' then it really is of type 'P' and you
can simply use it. Casts are not needed becuase python/jython is
smart enough to figure out the type on its own (at runtime, of course).
HTH,
-D
_______________________________________________
Jython-users mailing list
Jyt...@li...
http://lists.sourceforge.net/lists/listinfo/jython-users
|