all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#33979: 26.1; python.el is not fully PEP 8 compliant for closing parens
@ 2019-01-04 20:48 Barry Warsaw
  2019-02-05 18:53 ` bug#33979: bug #33979; python.el is not fully PEP 8 compliant Bhavin Gandhi
  0 siblings, 1 reply; 3+ messages in thread
From: Barry Warsaw @ 2019-01-04 20:48 UTC (permalink / raw)
  To: 33979

[-- Attachment #1: Type: text/plain, Size: 2752 bytes --]

I am spending some time playing with the default python.el to see where
it differs from the externally maintained python-mode.el.  AFAICT,
python.el does not fully support PEP 8 (the document, not the tool) for
the indentation of closing parentheses.

Given this code, typed contemporaneously:

NUMBERS = [
    (1, 2),
    (3, 4),
    (5, 6),
           ^----point

Now I hit RET and ]

NUMBERS = [
    (1, 2),
    (3, 4),
    (5, 6),
    ]
     ^----point

However, if I hit TAB at point, the closing bracket gets moved to column
0:

NUMBERS = [
    (1, 2),
    (3, 4),
    (5, 6),
]

While this style is PEP 8 compliant, so is this:

NUMBERS = [
    (1, 2),
    (3, 4),
    (5, 6),
    ]

i.e. with the closing brace lined up under the beginning of the last
line.  Quoting PEP 8:

> The closing brace/bracket/parenthesis on multiline constructs may
> either line up under the first non-whitespace character of the last
> line of list, as in: [EXAMPLES THAT LOOK LIKE WHAT I WANT]
> ...
> or it may be lined up under the first character of the line that
> starts the multiline construct, as in: [EXAMPLES THAT LOOK LIKE
> PYTHON.EL]

I've looked at python-indent--calculate-indentation in python.el and
AFAICT, there's no way to customize this behavior.  Thus, python.el
violates PEP 8.



In GNU Emacs 26.1 (build 1, x86_64-apple-darwin17.5.0, NS appkit-1561.40 Version 10.13.4 (Build 17E202))
of 2018-05-30 built on resist.local
Windowing system distributor 'Apple', version 10.3.1671
Recent messages:
Checking 24 files in /usr/local/Cellar/emacs/26.1_1/share/emacs/26.1/lisp/cedet...
Checking 57 files in /usr/local/Cellar/emacs/26.1_1/share/emacs/26.1/lisp/calendar...
Checking 87 files in /usr/local/Cellar/emacs/26.1_1/share/emacs/26.1/lisp/calc...
Checking 105 files in /usr/local/Cellar/emacs/26.1_1/share/emacs/26.1/lisp/obsolete...
Checking for load-path shadows...done
You can run the command ‘report-emacs-bug’ with M-x r-em RET
Checking for load-path shadows...done
previous-line: Beginning of buffer [8 times]
Quit [6 times]
report-emacs-bug-insert-to-mailer: Subject, To or body not found
Quit [2 times]
Configured using:
'configure --disable-dependency-tracking --disable-silent-rules
--enable-locallisppath=/usr/local/share/emacs/site-lisp
--infodir=/usr/local/Cellar/emacs/26.1_1/share/info/emacs
--prefix=/usr/local/Cellar/emacs/26.1_1 --with-gnutls --without-x
--with-xml2 --without-dbus --without-imagemagick --with-ns
--disable-ns-self-contained'

Configured features:
JPEG NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS THREADS

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Py

[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#33979: bug #33979; python.el is not fully PEP 8 compliant
  2019-01-04 20:48 bug#33979: 26.1; python.el is not fully PEP 8 compliant for closing parens Barry Warsaw
@ 2019-02-05 18:53 ` Bhavin Gandhi
  2019-02-05 22:31   ` Barry Warsaw
  0 siblings, 1 reply; 3+ messages in thread
From: Bhavin Gandhi @ 2019-02-05 18:53 UTC (permalink / raw)
  To: 33979; +Cc: barry

> I've looked at python-indent--calculate-indentation in python.el and
> AFAICT, there's no way to customize this behavior.  Thus, python.el
> violates PEP 8.

Just trying to understand this. The Python code one will type with 
python.el will still be PEP8 compliant (correct me if I'm wrong). But 
the python.el does violate PEP8 because it does not provide way to 
customize this indentation behavior for closing brackets, right?





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#33979: bug #33979; python.el is not fully PEP 8 compliant
  2019-02-05 18:53 ` bug#33979: bug #33979; python.el is not fully PEP 8 compliant Bhavin Gandhi
@ 2019-02-05 22:31   ` Barry Warsaw
  0 siblings, 0 replies; 3+ messages in thread
From: Barry Warsaw @ 2019-02-05 22:31 UTC (permalink / raw)
  To: Bhavin Gandhi; +Cc: 33979

[-- Attachment #1: Type: text/plain, Size: 562 bytes --]

On Feb 5, 2019, at 10:53, Bhavin Gandhi <bhavin7392@gmail.com> wrote:
> 
>> I've looked at python-indent--calculate-indentation in python.el and
>> AFAICT, there's no way to customize this behavior.  Thus, python.el
>> violates PEP 8.
> 
> Just trying to understand this. The Python code one will type with python.el will still be PEP8 compliant (correct me if I'm wrong). But the python.el does violate PEP8 because it does not provide way to customize this indentation behavior for closing brackets, right?

Correct!  Thanks for your consideration.


[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-02-05 22:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-04 20:48 bug#33979: 26.1; python.el is not fully PEP 8 compliant for closing parens Barry Warsaw
2019-02-05 18:53 ` bug#33979: bug #33979; python.el is not fully PEP 8 compliant Bhavin Gandhi
2019-02-05 22:31   ` Barry Warsaw

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.