Tuesday, April 27, 2004, 3:55:29 PM, you wrote:
>> CK> use:
>> CK> print Modifier().toString(2)
>>
>> Am I missing something here?
>>
>> >>> print Modifier.toString(2)
>> 2
>>
CK> yes:
Well, Jeff pointed out I was missing the brackets!
CK> >>> print Modifier().toString(2)
CK> >>> type( Modifier )
CK> <jclass org.python.core.PyJavaClass at 8331318>
CK> >>> type( Modifier() )
CK> <jclass org.python.core.PyJavaInstance at 14869110>
CK> use of a (anonymous) instance rather than the class seems to be ok.
Yes, but I'm not sure that making the instance anonymous rather than
explicit really helps... Although there's a question there as to
whether my reluctance to use that form is rooted in reality with the
current-generation of garbage collectors...
I'm still slightly intrigued as to what's going on such that the
static "toString(int mod)" method on the class isn't being called.
I tried the following to try & help ensure that the correct
type-conversion was occurring, but that made no difference...
>>> import java.lang.Integer as Integer
>>> import java.lang.reflect.Modifier as Modifier
>>> Modifier.toString(Integer.parseInt('2'))
'2'
My guess is that either there's an conversion (to PyInteger?)
getting in the way somewhere but I've not idea how to either prove or
disprove the guess.
--
Best regards,
Gwyn mailto:gwyn@...
|