[Python-ideas] Restore the __members__ behavior to python3 for C extension writers

Barry Scott barry at barrys-emacs.org
Tue Jun 13 14:42:55 EDT 2017


I have been trying to get dir(c_ext_obj) to work for PyCXX as the method used with
python2 was removed in python3, namely use the list of names returned from 
the __members__ attribute.

I have failed to find a simple replacement for the python3 API.

It seems that I have implement __dir__.
But to do that I need to know what dir() will return and add the member variables to the answer.
I have been able to figure out what is necessary to write such code.
No one on python users or python dev responded to an earlier query on this subject.

Would it be possible to simply put back the support for the __members__ attribute in python3?
Or provide a API call to get the list that dir() would produce for my object.

Barry





More information about the Python-ideas mailing list