dir() on C object type

Mark Rowe mark21rowe at yahoo.com
Tue Sep 18 01:06:33 EDT 2001


"Ignacio Vazquez-Abrams" <ignacio at openservices.net> wrote in message
news:mailman.1000704078.5698.python-list at python.org...
> On Mon, 17 Sep 2001, Mark Rowe wrote:
>
> > I've just been playing around with building some object types using C.
> > Everything seems to be going fine, and I'm starting to get my head
around
> > the reference side of things, but one thing still bugs me.  When I
execute
> > the dir() function on an instance of my type, I get an empty list.  Is
there
> > something I need to do to have its methods show up?
>
> You have to use Py_FindMethod() in your getattr handler with the special
name
> '__methods__'.
>
> --
> Ignacio Vazquez-Abrams  <ignacio at openservices.net>
>
>

I already have the Py_FindMethod() call in all of my getattr handlers.  I
now know that I can see the methods
through the __methods__ attribute, but still no luck with the dir() call.
It still gives me an empty list.

Mark





More information about the Python-list mailing list