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

extend dill.source.getsource for non-function-like objects #20

Closed
mmckerns opened this issue Jan 21, 2014 · 1 comment
Closed

extend dill.source.getsource for non-function-like objects #20

mmckerns opened this issue Jan 21, 2014 · 1 comment

Comments

@mmckerns
Copy link
Member

dill.source.getsource is pretty good about getting the source for imported and interactively defined function, lambdas, and class methods. It'd be nice to get the source code for classes and class instances and such. Currently, assumes the inspected object has a func_code attribute.

@mmckerns
Copy link
Member Author

getblocks and getsource can grab class code (from file or interpreter) as of e67781b. getblocks can also get the class source for class instances, but not the constructor for the instance. getsource can get the class source and the constructor for instances if there's a nice repr for the instance… otherwise it raises an AttributeError (intentionally). Is this good? Not sure.

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

No branches or pull requests

1 participant