How do I get type methods?
Thomas Nelson
thn at mail.utexas.edu
Fri May 4 10:38:04 EDT 2007
On May 4, 7:59 am, yavanna... at yahoo.com wrote:
> On 4 ÍÁÊ, 09:08, "Gabriel Genellina" <gagsl-... at yahoo.com.ar> wrote:
>
> > En Fri, 04 May 2007 01:34:20 -0300, <yavanna... at yahoo.com> escribio:
> > > I'm not against 'dir(MyClass)'; the question is, what should I 'dir()'
> > > to get methods of 'pyuno' type instance?
> > Usually instances don't have its own methods, they get them from the
> > class. So you actually need dir(MyClass).
> > Note that dir() might not show all available methods.
>
> Let me retype my question: what I 'dir()' in case of 'pyuno' type
> instance?
> Or in case of 'dict' type instance? Or in case of any other new python
> type?
>>> class Foo:
... def f(self,x):
... print x+1
... def g(self,x):
... print x-1
...
>>> dir(Foo)
['__doc__', '__module__', 'f', 'g']
Is this not what you want? These are the only methods in the Foo
class.
Tom
More information about the Python-list
mailing list