GNU bug report logs -
#29003
[python.el] Docstring from PEP 257 is filled incorrectly by Emacs
Previous Next
Reported by: Radon Rosborough <radon.neon <at> gmail.com>
Date: Thu, 26 Oct 2017 02:10:01 UTC
Severity: minor
Tags: wontfix
Found in version 25.3
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 29003 in the body.
You can then email your comments to 29003 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29003
; Package
emacs
.
(Thu, 26 Oct 2017 02:10:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Radon Rosborough <radon.neon <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 26 Oct 2017 02:10:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
I recently noticed that Emacs fills an example docstring given [1] in
PEP 257 incorrectly. With `python-fill-docstring-style' at its default
value of `pep-257', the following code sample:
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
...
is filled to:
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
...
There are two issues here: the extra newline added, and the unwrapping
of the keyword arguments. The extra newline can be suppressed by
changing the value of `python-fill-docstring-style', but the keyword
argument unwrapping does not appear to be suppressible. This seems
erroneous to me since the value of `python-fill-docstring' would suggest
PEP 257 compliance, i.e. the examples given in PEP 257 should not be a
affected by wrapping. (I also checked out the third-party package
`python-docstring' [2], and it has the same behavior.)
Changed bug title to '[python.el] Docstring from PEP 257 is filled incorrectly by Emacs' from '25.3; Docstring from PEP 257 is filled incorrectly by Emacs'
Request was from
Noam Postavsky <npostavs <at> users.sourceforge.net>
to
control <at> debbugs.gnu.org
.
(Thu, 26 Oct 2017 12:28:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29003
; Package
emacs
.
(Thu, 26 Oct 2017 19:03:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 29003 <at> debbugs.gnu.org (full text, mbox):
> Keyword arguments:
> real -- the real part (default 0.0)
> imag -- the imaginary part (default 0.0)
I think all Emacs fill commands will fill this as one continous line,
unless you make the newlines between these lines "hard", as with M-x
use-hard-newlines (which is actually a minor mode, I think).
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29003
; Package
emacs
.
(Thu, 26 Oct 2017 19:25:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 29003 <at> debbugs.gnu.org (full text, mbox):
> I think all Emacs fill commands will fill this as one continous
> line,
As it currently stands, yes. That doesn't have to be the case,
however. For example, package `python-docstring' can understand reST
syntax, so that:
def example_function():
"""Initialize engine.
:param holes: Number of holes.
:param rounds: Number of rounds.
:param colors: Number of colors.
:returns: Game engine instance.
"""
pass
is not modified when filled. The question is whether the example given
by PEP 257 should be considered "standard" syntax for introducing
keyword arguments, and whether such syntax should be supported by
Emacs in a similar way to how `python-docstring' supports reST syntax.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29003
; Package
emacs
.
(Thu, 26 Oct 2017 19:41:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 29003 <at> debbugs.gnu.org (full text, mbox):
It would be great if the example given was standard practice, but that
doesn't seem so. The example also doesn't show how you might document
standard key arguments (without a default), which would be vital in
everyday usage.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29003
; Package
emacs
.
(Mon, 11 Nov 2019 02:44:01 GMT)
Full text and
rfc822 format available.
Message #19 received at 29003 <at> debbugs.gnu.org (full text, mbox):
Radon Rosborough <radon.neon <at> gmail.com> writes:
>> I think all Emacs fill commands will fill this as one continous
>> line,
>
> As it currently stands, yes. That doesn't have to be the case,
> however. For example, package `python-docstring' can understand reST
> syntax, so that:
>
> def example_function():
> """Initialize engine.
>
> :param holes: Number of holes.
> :param rounds: Number of rounds.
> :param colors: Number of colors.
>
> :returns: Game engine instance.
> """
> pass
>
> is not modified when filled. The question is whether the example given
> by PEP 257 should be considered "standard" syntax for introducing
> keyword arguments, and whether such syntax should be supported by
> Emacs in a similar way to how `python-docstring' supports reST syntax.
I think this should ideally be supported by Emacs, but it should be
configurable and disabled by default.
Best regards,
Stefan Kangas
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29003
; Package
emacs
.
(Tue, 30 Nov 2021 14:58:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 29003 <at> debbugs.gnu.org (full text, mbox):
Stefan Kangas <stefan <at> marxist.se> writes:
> > > 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
> > > ...
[...]
>> is not modified when filled. The question is whether the example given
>> by PEP 257 should be considered "standard" syntax for introducing
>> keyword arguments, and whether such syntax should be supported by
>> Emacs in a similar way to how `python-docstring' supports reST syntax.
>
> I think this should ideally be supported by Emacs, but it should be
> configurable and disabled by default.
I think introducing these kinds of semantics in doc strings is
inherently brittle (unless really well-defined). For instance,
If this is a doc string, and then I
pause -- using a double dash for a
pause is common -- then we'd be filling
things differently.
So I don't think changing the pep-257 style would be appropriate, and I
think adding a user option for this wouldn't receive much use. So I'm
closing this bug report.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Added tag(s) wontfix.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Tue, 30 Nov 2021 14:58:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
29003 <at> debbugs.gnu.org and Radon Rosborough <radon.neon <at> gmail.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Tue, 30 Nov 2021 14:58:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 29 Dec 2021 12:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 199 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.