Is it possible to block comment Python code in TextWrangler - python

I am using the excellent "Learn Python The Hard Way" tutorials and i am wondering does anyone know if its possible to create block comments in it? I note from a similar question here that it does not seem to be possible in Python but that some editors have implemented methods to do it.
EDIT
I have edited the above question to provide more detail and to use the term "block comment" insted of "block quote"
Thanks

This is a duplicate question: Commenting/Uncommenting a block of Python code in TextWrangler
However, I recommend you not bother with those 9 steps and instead just download sublime text 2.
It is an excellent editor for Python (I believe that's the language its written in, in fact.) and you can accomplish what you're looking for by simply highlighting the code block and using the comment/uncomment keyboard shortcut: Ctrl+Shift+/

In textwrangler on a mac, this worked for me. Highlight the text you want to comment out. Hold down the Command Key and hit /.

Related

Collapse python comment in vs code

Not long ago, I started commenting a lot of code in python, the problem is that vs code does not offer me to reduce the comment.
I have tried single line comments and group comments but same issue..
python single line comment
python multiline program
In other languages for example C.. it offers me in the bar a button to collapse
example in C
How can comment collapsing be enabled in VS?
I tried it. I think vscode itself provides this function, but I don't know why it doesn't work for you.
As can be seen from the figure, multiline annotations can be folded.
Of course, there is no solution for your situation. We can add #region before the content, add #endregion after it.

Why is the word file get highlighted in .py files in the Vim text editor?

The word "file" in python is not a keyword, but my Vim highlights it as if it were. Can someone suggest a fix and explain this strange behaviour? It keeps messing with me. It bothers me every time I look at it.
Extra info
I think I use regular Vim—I haven't tinkered with my .vimrc much, certainly not with the syntax highlighting.
Many builtins were removed in the Python 2 to 3 transition. file is one of them. Lots of syntax highlighters still highlight them. Now that Python 2 is no longer supported, maintainers may be willing to remove them from the lists, so you can try opening an issue if it bothers you.

Is it possible to comment out cells in Spyder?

I am working in Spyder and was wondering if there is any way to comment out a whole block delimited by the common #%%. Consider the example below:
#%% Block 1
for i in range(10):
print(i)
# (other stuff)
#%% Block 2
Is it possible to comment out everything inside the Block 1 by any keybind shortcut (I'm working on Windows)?
By the way, I'm aware I can select all the lines and use Ctrl + 4 or Ctrl + 1 equivalently. I also checked this document with no success.
Thanks in advance, and sorry if this have already been asked (couldn't find any useful post myself).
(Spyder maintainer here) Unfortunately this is not possible at the moment, sorry.

emacs Jedi disable #

I have a working version of JEDI with Emacs 24.3 on osx. The autocomplete feature is wonderful, except for when I want to comment things out! I frequently comment/uncomment portions of my code and was hoping there was a way to prevent JEDI's auto completion from coming up when I type #. Any advice or thoughts would be greatly appreciated!
edit: When I go to comment multiple lines I enter in # typically followed by DownArrow and LeftArrow, but what usually happens with JEDI enabled is this dialog pops up preventing me from moving to the following line until I make a selection:
You can try to use company-jedi for your python completion. This package doesn't have this problem.
One way to get around this issue would be to select the lines (region) you would like to comment out and hit M-;. This runs the command comment-dwim which comments out the selected region (or uncomments it, if it is currently commented out).
When used in conjunction with e.g. mark-lines which allows you to select the current line with a single key stroke, this makes for a really fast way of (un)commenting portions of your code, even if they span just one or two lines.
emacs-jedi dev here. If emacs-jedi works as you describe, then that's a bug.
But I cannot say what is wrong from the limited information I have. So, just general directions:
First, always try to reproduce the misbehavior in a clean Emacs setting, described here http://tkf.github.io/emacs-jedi/latest/#quick-try
This helps you to find out if your setting is wrong or if it is actually a bug in emacs-jedi.
Give the output of M-x jedi:show-version-info. http://tkf.github.io/emacs-jedi/latest/#jedi:show-version-info
This helps people diagnosing the problem.
This is a guess from your screenshot but it seems that you have old version of popup.el. So maybe auto-complete.el could be old one if you install them at the same time. If you don't see the problem in the clean Emacs (step 1. I mentioned above) which installs newest libraries, then updating them could solve the problem.
Update
So, I found a way to reproduce the behavior which is close to what you mentioned: https://github.com/tkf/emacs-jedi/issues/147
But as I wrote in the issue, I think it is a rare case. If you find a case which could happen very frequently, then let me know.

Getting proper code completion for Python on Vim?

I've gotten omnicompletion with Pysmell to work before, but I can't seem to do it again.
I tried following some steps online, but most, if not all, of them are to vague and assume too much that you know what you are doing to some extent.
Can someone post a full, step-by-step tutorial on how to get code completion working properly, for complete Vim newbies (for dummies?)?
There's also Ctrl+n in insert mode which will autocomplete based on the words it has seen in any of the open buffers (even in other tabs).
You may try Pydiction (Excerpt below)
Description Pydiction allows you to
Tab-complete Python code in Vim,
including: standard, custom and
third-party modules and packages. Plus
keywords, built-ins, and string
literals.
Pyflakes has a vim plugin that does this pretty awesomely. Unlike Pydiction, you don't need to build a dictionary beforehand (so if you're bouncing between different virtualenvs it's a bit less hassle.) I haven't been using it long but it seems very slick.
Try hitting Ctrl-p while typing mid-word. Ctrl-p inserts the most recent word that starts with the prefix you're typing and Ctrl-n inserts the next match. If you have several possibilities, you can hit ctrl-p more than once to substitute each candidate in order.

Categories

Resources