Skip to content

feat(types): add __dir__ to RESTObject to expose attributes #1072

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

Merged
merged 1 commit into from
Apr 14, 2020
Merged

feat(types): add __dir__ to RESTObject to expose attributes #1072

merged 1 commit into from
Apr 14, 2020

Conversation

spyoungtech
Copy link
Contributor

@spyoungtech spyoungtech commented Apr 14, 2020

This change adds the __dir__ magic method to the RESTObject class in order to expose and allow introspection on the attributes that the object might have.

This is very useful to me when exploring the API in an interactive console.

Normally I'll call dir(obj) (or obj? in iPython shell) to try to discover what methods and attributes exist for the object. However, the attributes in the .attributes property are not currently exposed, requiring the extra step of checking .attributes on each object I explore this way.

Hope this makes sense and that this change, if accepted, will help others.

@max-wittig
Copy link
Member

Didn't even know about dir() 😮

This change does make sense! Thanks for your contribution!

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