On 2020-09-27 10:27, Stephane Tougard via Python-list wrote:
On 2020-09-27, Stefan Ram <r...@zedat.fu-berlin.de> wrote:
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 ?
We usually do not wish to tie our code to a defective editor.
I use vi, and can assure you that there is no such restriction
in a real editor.
It's funny, I've made a few tests and I see that pass has no impact on
if block in fact, I can put it anywhere and add code behind, it works
fine. I was sure that pass was breaking the if block, it does not.
That's however still the way Emacs seems to see it (I can not add
any code in a if block after a pass, pass acts as if it breaks the if
block).
As pass does nothing anyway, that looks like a good way to mark the end
of a block and I did not find any valid reason to not use it this way.
That's not a question of editor, that's a question of having a clear way
to mark the end of a block, I guess the Emacs maintener found this way
and I think it's a great idea.
If a extremist Pythonist takes over my code some day, he'll have to
search and delete hundreds of useless pass. I laugh already thinking
about it.
He could write some code to do it.
--
https://mail.python.org/mailman/listinfo/python-list