Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ffi (Object): make class dict visible in instances #5843

Merged
merged 1 commit into from
Jun 18, 2020

Conversation

t-vi
Copy link
Contributor

@t-vi t-vi commented Jun 18, 2020

In Python, generic objects (i.e. non-types/classes) inherit the __dir__ elements from their class.
This enable tab completion in interactive environments like Jupyter notebooks.

Reference for this behaviour is Python's __dir__ for objects:
https://github.com/python/cpython/blob/8f192d12af82c4dc40730bf59814f6a68f68f950/Objects/typeobject.c#L4854-L4899

I'll readily admit that I don't know whether the location for the test I offer is a good one. It seemed to be a place where low-level stuff is tested and where this can blend in.

@t-vi
Copy link
Contributor Author

t-vi commented Jun 18, 2020

@tqchen / @zhiics I think you're closest to this code.

@tqchen tqchen merged commit 9ba98be into apache:master Jun 18, 2020
@tqchen
Copy link
Member

tqchen commented Jun 18, 2020

Thanks @t-vi !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants