Viewing object attributes with tab completion in sublimerepl python - python

In the IDLE interpreter in Python, you can see a drop-down list of an object's attributes by typing the object's name, then period, then hitting TAB.
Is it possible to get similar functionality with sublimerepl?
I've tried the different autocomplete packages, but they don't appear to make this happen.

So there are many different packages, Andy's package being my favorite. None provide every method for a given function but try hitting "ctrl-space" after the period to see what's available!
Link:
https://sublime.wbond.net/packages/AndyPython

Related

Function arguments suggestion/autocomplete in VSCode for Python

In RStudio, function variables, parameters or arguments are displayed by pressing tab.
While VSCode has a lot of features, I cannot find a similar one for Python.
I found a way for VSCode to show me the definition of the function while hovering in the function itself, but there are no autocompletion for the actual variables of that function (nor suggestions while writing). Besides, the tooltips close itself as soon as I start typing the variables.
Is there a way to get something more similar regarding autocompletion and suggestion of function variables in VSCode while using Python?
Thanks.
According to your description, it is recommended that you use the extension "Pylance", which provides outstanding language service functions.
Its 'Docstrings' and 'auto-completion' functions show us the function parameters and will not close the prompt when inputting:
Part of its function introduction:

Python Syntax Highlighting in Xcode

Is there any way to achieve better syntax highlighting in Xcode for Python? Xcode only identifies and colorizes keywords, strings, numbers and comments. It doesn't seem to be able to identify the self variable name that represents instance objects. I've experimented with other color themes but it doesn't change the fact that Xcode cannot identify names for instance objects in Python. Is there any way to achieve better syntax highlighting?
I'm using xcode12;after you have setup python properly in xcode.(refer to this if you are not sure of your setup: https://youtu.be/h8_68OONY-w)
Now to get back 'syntax highlighting' for python code.Click on the 'Editor' tab on the menu bar, click on 'syntax colouring' and choose 'python' from the list and you must be fine.

Python IDLE won't show docstring

My IDLE (Python 3.4.3) won't show functions doc-strings when typing the name of the function.
Is anybody familiar with this problem?
I've tried everything, including uninstall etc. Answers on the web are nowhere to be found.
I'm talking about showing the docstrings automatically, NOT when specifically typing :
print(func. __ doc __)
Thanks
Docstrings, are part of calltips, not completions. Calltips are shown when one types '(' after the name of an acccessible function. The calltip should stay displayed until one types ')' or clicks the mouse or otherwise moves the cursor to dismiss it. Cntl-\ brings it back.
A calltip consists of the function signature and the first line of the docstring. For builtins without an accessible signature (such as, in 3.4.3, int or bytes), the calltip consists of all lines up the fifth line or the first blank line.
The set of accessible functions depends on what modules have been imported into the user process (where your code is executed), including those imported by Idle itself, and what code has been run (since the last restart). For example, restart the Shell (Cntl-F6), open a new editor window, and enter
itertools.count(
A calltip appears because Idle imports itertools into the user process for its own use. Enter
turtle.write(
and nothing appears, because the Idle does not import turtle. Cntl-\ does nothing either. Entering
import turtle
above the function call does not immediately help, but if one runs the file to perform the import, calltips for turtle functions become available.
This suggests that one might want to run a file after writing the import statements at the top, or immediately run an existing file before editing.
Comments:
I suspect your problem is that you are trying to get a calltip for a function that is not currently accessible, even though it might have been accessible before and will become accessible after running your code.
I have opened issue 24028 to add something like the above to the Idle docs as a subsection on calltips after the subsection on completions
Existing issue 1350 is about adding the option to display the full docstring.
The availability issue is a nuisance. I have a couple of ideas for improving it. In the meanwhile, use the suggestion above about running your imports.
EDIT: 2018 Aug 2
Some combinations of Mac OSX or MacOS and tcl/tk require an addition of one line to idlelib/calltip_w.py (3.6+) or idlelib/CallTipWindow.py (3.5-). Issue 34275
self.label.pack() # Line 74
tw.update_idletasks() # ADD THIS LINE!
tw.lift()
This should be included in future releases. If the above does not work, please remove _idletasks

How do I display function arguments in ipython qtconsole?

I'm using IPython qtconsole under windows 7, and when I first write a method name and type the bracket, a popup shows method parameters.
What is the way to display that popup explicitly, once it has disappeared? This is pretty common 'show method parameters' shortcut that I'm talking about, but I've failed to find the shortcut to it after an embarrassing amount of google searches.
In Spyder, try View - Panes - Object inspector. Then type the full name of the function.
I would highly recommend relying on the Python Library Reference rather than any in-IDE tools, at least for functions and classes that are in the standard library. For objects outside those libraries however... it looks like you can type object_name followed by a question mark, that is, object_name?, to get a list of informative details about the object. (Since everything is an object, this presumably includes functions.)
For your specific question, it looks, from the iPython docs, like the TAB key is what you're looking for, but somehow I doubt you haven't already tried that.

Can Rope auto-completion (RopeCodeAssist) in vim not automatically insert results?

I am using Rope for my python auto-completion in vim. However, one thing that annoys me is that it auto-inserts its suggestions, making me unable to narrow down choices by continuing to type. This means that if I see my desired completion at the bottom of the list, I must move through the entire list with the down-arrow-key to select it.
My preferred usage would be seeing the list of suggested completions and be able to continue typing, which automatically removes items from the list that don't begin with my typed characters. An extra bonus would be the ability to then move down the list with the tab key.
In short, I would like the completion selection process to be like vim's omnicompletion when the options completeopt=longest,menu,menuone are set. Is this possible?
python-mode sets Vim's omnifunc to use Rope completion, which should do what you want.
Otherwise, you could check out this rope-omni plugin.
rope-omni plugin has been merged into the standard ropevim in this commit. And yes, https://github.com/python-rope/ is now the official home of all rope projects.

Categories