About 1,370,000 results
Open links in new tab
  1. What is the proper way to comment functions in Python?

    Dec 14, 2019 · Read about using docstrings in your Python code. As per the Python docstring conventions: The docstring for a function or method should summarize its behavior and document its arguments, return value(s), side effects, exceptions raised, and restrictions on when it can be called (all if applicable). Optional arguments should be indicated.

  2. How do I create multiline comments in Python? - Stack Overflow

    Apr 9, 2022 · For commenting out multiple lines of code in Python is to simply use a # single-line comment on every line: # This is comment 1 # This is comment 2 # This is comment 3 For writing “proper” multi-line comments in Python is to use multi-line strings with the """ syntax Python has the documentation strings (or docstrings) feature. It gives ...

  3. How to comment out a block of code in Python [duplicate]

    Python does not have such a mechanism. Prepend a # to each line to block comment. For more information see PEP 8. Most Python IDEs support a mechanism to do the block-commenting-with-hash-signs automatically for you. For example, in IDLE on my machine, it's Alt+3 and Alt+4.

  4. Shortcut to comment out multiple lines with Python Tools for …

    May 30, 2011 · for me, you answered my question, install Python Tools for Visual Studio VS was highlighting first class symbols but that's about it, strangely only barks when using the normal hotkeys, without the tools, maybe this is the intention because it works for things like JSON and XML... thanks for the slight manipulation MS –

  5. Shortcut key for commenting out lines of Python code in Spyder

    Apr 15, 2016 · Yes, there is a shortcut for commenting out lines in Python 3.6 (Spyder). For Single Line Comment, you can use Ctrl+1. It will look like this #This is a sample piece of code. For multi-line comments, you can use Ctrl+4. It will look like this. …

  6. coding style - Why does python use unconventional triple …

    Nov 22, 2017 · Python only has "to the end of the line" comments, it has no explicit multi-line comment wrapper (as opposed to javascript's /* .. */). Most Python IDEs let you select-and-comment a block at a time, this is how many people handle that situation. Then there are normal single-line python strings: They can use ' or " quotation marks (eg 'foo' "bar ...

  7. Is there a shortcut to comment multiple lines in python using VS …

    Oct 28, 2024 · Command + / to comment and uncomment multiple lines of Python code on Mac. Share. Improve this answer ...

  8. What is the proper way to comment code in Python? [closed]

    I don't know if this represents the "community standard" but here are Google's Python style guides (as they relate to comments). Specifically classes: Specifically classes: class SampleClass(object): """Summary of class here.

  9. comments - Commenting code in Notepad++ - Stack Overflow

    Let me summarize the answers for others' benefit (for python and notepad++) 1) Ctrl+K on multiple lines (i.e. selected region) allows you to block comment. Also note that pressing the combination multiple times allows you to add multiple "#"s (sometimes I use that while testing to differentiate from other comments)

  10. How to comment out a block of Python code in Vim

    Apr 1, 2010 · I prefer the comment char to occur at the beginning of the line... but much more importantly, 'commenting comments' is really rather important. I'd also drop the au BufEnter *.py, since # comments are general enough for the commands to be used in all buffers by default. –