On 9/26/2020 3:36 PM, Stephane Tougard via Python-list wrote:
On 2020-09-26, Terry Reedy <tjre...@udel.edu> wrote:
Noise. Only 'pass' when there is no other code.
Why ?
I use pass and continue each time to break a if or a for because emacs
understands it and do not break the indentation.
Is there any other instruction to end a if than pass and ensure Emacs
does not break the indentation during a copy paste or an indent-region ?
Emacs should come with python.el or python-mode.el defining a
python-mode. Are you using it? I presume it understands python block
structure without extra passes.
emacs with python-mode has been and likely still is used by some
experienced python programmers. I have never seen anyone but a rank
beginner misunderstanding 'pass' misusing it as an end-block marker.
(Ditto for putting ';' at the end of every line.) Dedents or EOF do that.
if a:
b = 3
pass
c = 5
else:
b = 1
c = 2
The 'pass' line does not mark the end of the if block.
Aside from not breaking most every existing Python program? If block
scoped, one would have to add an otherwise useless fake declaration
before the block to use the name outside the block. Python tries to
avoid boilerplate code.
I'm not talking about a general change in Python as a language, I'm
talking about a module who would enforce a block namespace as it works with
C or Perl (and many).
The existence of a permanent alternate syntax mechanism would be a
general change to the language.
Python only has a temporary overlap mechnism:
from __future__ import new_syntax.
This gives people usually 2 versions to adjust to a new syntax that
breaks compatibility by switching to the new syntax anytime before it
becomes mandatory.
For example, making 'with' a keyword broke any other use of the word.
So people temporarily had to add
from __future__ import with_statement
at the top of a file to use with statements in that file.
--
Terry Jan Reedy
--
https://mail.python.org/mailman/listinfo/python-list