Python.el does not correctly handle Mq padding on docstrings

For function

def foo():
  """
  etc
  stuff
  """
  pass

when I run Mq before the paragraph before my docstrings, emacs (24.3.1, python.el) reformatts foo as follows:

def foo():
  """etc
  stuff
  """
  pass

How can I tell python.el to leave it alone? (I know this behavior is new, older emacs on another computer (to which I do not have access) did not).

+4
source share
1 answer

What the python.elPython convention actually does (albeit without an empty line after the first line) - see the PEP-0257 example:

def complex(real=0.0, imag=0.0):
    """Form a complex number.

    Keyword arguments:
    real -- the real part (default 0.0)
    imag -- the imaginary part (default 0.0)
    """
    if imag == 0.0 and real == 0.0:
        return complex_zero

python.el, - 'python-fill-docstring-style', pep-257, :

:type '(choice
          (const :tag "Don't format docstrings" nil)
          (const :tag "Django coding standards style." django)
          (const :tag "One newline and start and Two at end style." onetwo)
          (const :tag "PEP-257 with 2 newlines at end of string." pep-257)
          (const :tag "PEP-257 with 1 newline at end of string." pep-257-nn)
          (const :tag "Symmetric style." symmetric))
+5

Source: https://habr.com/ru/post/1541311/


All Articles