How to add code comment?

I suppose I should use "show context actions" from the context menu to add code comment, but when I click it, it shows that 'no context actions at this location'. I put the caret within and outside of the function I want to comment, but it always gives this information. 

 

How to add standard code comments in PyCharm?

4 comments
Comment actions Permalink

Hi,

If you mean python comments, they are denoted with "#" character

If you mean docstring, you can add one with the context action:

0
Comment actions Permalink

How to get the context action? In my case, it shows ' 'no context actions at this location''

0
Comment actions Permalink

Placing the caret on the function name and pressing Alt+Enter should do the trick. If it's not working, please provide screenshots demonstrating the issue, and I may need steps to reproduce.

0
Comment actions Permalink

Got it  and thank you.

0

Please sign in to leave a comment.