Questions on 1.6a2's string methods

Janko Hauser jhauser at ifm.uni-kiel.de
Fri Apr 14 04:22:28 EDT 2000


Manus Hand <mjhand at concentric.net> writes:

> 3.  Are the classlike standard types (list, dictionary, and now
>     string) equipped with a __dict__ attribute?  I can see the names
>     of all functions supported by a user-defined class by saying
>     className.__dict__.keys(), but I cannot see the list of methods
>     for the string type (at least not in the same way).  Thus my
>     need to ask silly questions like #1 above (maybe capwords is
>     there by some other name??)
> 
 I haven't tried it with the new string type but you can look up the
 methods bye the __methods__ attribute.

>>> a=[1,2]
>>> a.__methods__
['append', 'count', 'extend', 'index', 'insert', 'pop', 'remove',
'reverse', 'sort']
>>> b={1:''}
>>> b.__methods__
['clear', 'copy', 'get', 'has_key', 'items', 'keys', 'update', 'values']


HTH
__Janko
-- 
  Institut fuer Meereskunde             phone: 49-431-597 3989
  Dept. Theoretical Oceanography        fax  : 49-431-565876
  Duesternbrooker Weg 20                email: jhauser at ifm.uni-kiel.de
  24105 Kiel, Germany



More information about the Python-list mailing list