bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#56903: progmode/python.el enhancement request.


From: Teika Kazura
Subject: bug#56903: progmode/python.el enhancement request.
Date: Wed, 03 Aug 2022 13:50:06 +0900 (JST)

This enhancement request is about progmode/python.el .

A
Let us follow up the commit 35d0190, "Properly indent Python PEP634 match/case 
blocks"
It introduced two code-block starter words, "match" and "case". Good. But 
"case" should also dedent, like shown in this tutorial [1], or PEP 636 [2]. (I 
failed to patch python.el. My naive attempt didn't work.)

[1] https://docs.python.org/3/tutorial/controlflow.html#match-statements
[2] https://peps.python.org/pep-0636/

B
"match" and "case" are not reserved words, but "soft keywords" [3]. This means 
they can be freely used as variables and function names.

[3] https://peps.python.org/pep-0634/#the-match-statement

I request they be font-locked like "if", "def" etc when used as a code block 
starter. (Something like r'^\s+(match|case)( .*)?:$'.) Currently they are shown 
in a plain face.

C
Some cleanups: In python.el, three comments mention "Python 3.5+ PEP492". It 
doesn't hurt at all, but Python 3.5 appeared back in 2015, [4] so IMHO removing 
them won't hurt, either.

[4] https://peps.python.org/pep-0478/

Thanks a lot for developing Emacs. Regards.
Teika





reply via email to

[Prev in Thread] Current Thread [Next in Thread]