From: Oti <oh...@ya...> - 2002-02-27 07:27:21
|
[ Waclawczyk Janusch ] >1. >I'm getting following result in jython (2.1): > > dir("String") > [] >but python's (2.1) answer is: > > dir("string") > ['capitalize', 'center', ...., 'upper'] >Ist this intended? >2. >The result of dir("string".__class__) in jython is not the same as dir("string") >in python. >Why? Hello Janusch, please note I am not a CPython expert. Nonetheless the Jython session below might give you some hints: Jython 2.1 on java1.3.0 (JIT: null) Type "copyright", "credits" or "license" for more information. >>> dir("String") [] >>> dir("string") [] >>> dir("any text") [] >>> import string >>> dir(string) ['_StringType', '__doc__', '__file__', '__name__', '_apply', '_float', '_idmap', '_idmapL', '_int', '_long', 'atof', 'atof_error', 'atoi', 'atoi_error', 'atol', 'atol_error', 'capitalize', 'capwords', 'center', 'count', 'digits', 'expandtabs', 'find', 'hexdigits', 'index', 'index_error', 'join', 'joinfields', 'letters', 'ljust', 'lower', 'lowercase', 'lstrip', 'maketrans', 'octdigits', 'replace', 'rfind', 'rindex', 'rjust', 'rstrip', 'split', 'splitfields', 'strip', 'swapcase', 'translate', 'upper', 'uppercase', 'whitespace', 'zfill'] >>> from java.lang import String >>> dir(String) ['CASE_INSENSITIVE_ORDER', 'bytes', 'charAt', 'compareTo', 'compareToIgnoreCase', 'concat', 'copyValueOf', 'endsWith', 'equalsIgnoreCase', 'getBytes', 'getChars', 'indexOf', 'intern', 'lastIndexOf', 'length', 'regionMatches', 'replace', 'startsWith', 'substring', 'toCharArray', 'toLowerCase', 'toUpperCase', 'trim', 'valueOf'] >>> dir( string.__class__ ) ['__delattr__', '__dict__', '__findattr__', '__setattr__', 'toString'] >>> Best wishes, Oti. __________________________________________________ Do You Yahoo!? Yahoo! Greetings - Send FREE e-cards for every occasion! http://greetings.yahoo.com |