Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make PyCharm 3.0 to add space after comment block or line

Tags:

python

pycharm

Normally in version 2.7 I could add comments in python by pressing ctrl+slash.
Result:

# class A(object):
#     def blah(self):
#         pass

After installation of PyCharm 3.0.

#class A(object):
#    def blah(self):
#        pass

I was searching in Setings > Project Setting > Code Style > Python and could not find anything.

Also I checked Settings > Keymap But seems to it is impossible to edit anything there. I tried also change keymap from Eclipse to different options but didn't help.

Annotation about right use of # with space. PEP8

How to do it?

like image 907
Bartosz Dabrowski Avatar asked Oct 03 '13 15:10

Bartosz Dabrowski


1 Answers

To Quote he documentation:

Block comments generally apply to some (or all) code that follows them, and are indented to the same level as that code. Each line of a block comment starts with a # and a single space (unless it is indented text inside the comment).

What you are perhaps referring to are inline comments, and I would totally agree with you.

In your case, it is indented, so its best to keep them the way they are. However, if you want to add a space after each comment # without too much hassle, you can do the following:

I got the cursor to be selected in the video by holding down the ALT key and dragging with out mouse. I would not usually add an animated gif, but I have done so for clarity.

enter image description here

like image 175
Games Brainiac Avatar answered Sep 28 '22 06:09

Games Brainiac