From: D-Man <ds...@ri...> - 2001-07-18 18:40:11
|
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 |