2

I remember seeing PyCharm and RStudio having a way of showing what data/modules/functions are in the current interactive session.

E.g. when you do a = [1, 2, 3], there will be a small part of the window giving information on the object a.

Is there any way we can have something similar in Emacs (perhaps making use of the python inspect module)?

1
  • Currently looking into this, wonder if you've found a solution! thanks Commented Feb 10, 2017 at 12:50

1 Answer 1

2

I usually run a python interactive session in emacs while coding python. With your source file open, press C-c C-z where you can specify which python interpreter you want to use. This will split the window in two with the source code on the left and the output/python shell on the right. While your source file is selected you can press C-c C-c to evaluate the buffer and have its output displayed in the window on the right. After evaluating your code you can switch to the shell with C-x o and while in the shell you can use dir() to list all variables, modules, functions, ect. as if you had done the while thing in an interactive python shell.

In your case you can run dir(a) or type(a) in the shell on the right.

Sign up to request clarification or add additional context in comments.

2 Comments

I'm aware of all that. You do not seem to understand my question. The whole point is not having to manually inspect objects, but to have Emacs be able to display what's in the workspace.
If that's the case then what you're actually asking for is help writing an elisp program that opens a python interactive session and makes eval calls on your behalf to scan and parse those same calls I mentioned above. You might want to edit your question to reflect this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.