Sujet : Re: Python (was Re: I did not inhale)
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.unix.shell comp.unix.programmer comp.lang.miscDate : 27. Aug 2024, 22:49:19
Autres entêtes
Organisation : None to speak of
Message-ID : <87y14hd4bk.fsf@nosuchdomain.example.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
User-Agent : Gnus/5.13 (Gnus v5.13)
Lawrence D'Oliveiro <
ldo@nz.invalid> writes:
On Tue, 27 Aug 2024 11:26:18 +0100, Bart wrote:
[...]
And, also the block then merges with the
following one as it's at the same level, so when you want to change it
back...
>
This is where my “#end” comments come in.
[...]
It's worth noting that you're the only person I've ever heard of
who feels the need to do this. People here who aren't familiar
with Python should be aware that this is not common practice.
I've done some Python programming, and it wouldn't occur to me to
add "#end" comments. If I saw them in a code review I'd probably
recommend deleting them. I prefer to approach each language on
its own terms. (I happen to like the way Python uses semantically
significant indentation, but even if I didn't I'd still do the same.)
In brace-delimited languages (C, C++, Perl, etc.), I'm very careful
to keep the indentation consistent with the program structure.
I do the same in Python. The difference is that in Python the
indentation is the single source of truth about program structure,
while in other languages it's a matter of convention.
https://en.wikipedia.org/wiki/Single_source_of_truthAs for tabs vs. spaces, my understanding is that recent versions
of Perl allow mixing them (something I avoid), but if the meaning
can change depending on the size of a tabstop the code is rejected.
-- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.comvoid Void(void) { Void(); } /* The recursive call of the void */