Search code examples
pythonjupyterjupyter-notebookdocstring

docstring (triple quotes) in iPython/Jupyter with autoclose brackets/quotes?


I'm trying to use docstrings w/ triple-quotes in my Jupyter notebooks using Python 2.7 .

I can disable the autoclose brackets/quotes thing but I'm quite keen on them; major increase in workflow.

Does anyone know how to do triple quotes without over-quoting while keeping the autoclose feature?

If I press the " key 3x I get """""";
If I press it 3x and delete once, I get """" pressing; and If I press it 3x and delete twice, I get ""

Annoying, right? How can I have the best of both worlds (autoclose | docstrings) ?

enter image description here


Solution

  • Nothing is wrong. When you type three " your cursor is at the middle of the resulting six. Thus, anything you type is within the string and has been auto-closed.

    Type this exact string of characters: """This is working without clicking or otherwise moving the cursor. The result will be a correcly formatted string, because it will have auto-closed the string. Therefore you have both strings and autoclose.