Path: csiph.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc Subject: Re: Python (was Re: I did not inhale) Date: Tue, 27 Aug 2024 14:49:19 -0700 Organization: None to speak of Lines: 35 Message-ID: <87y14hd4bk.fsf@nosuchdomain.example.com> References: <20240826083330.00004760@gmail.com> <20240826155113.000005ba@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Tue, 27 Aug 2024 23:49:23 +0200 (CEST) Injection-Info: dont-email.me; posting-host="90d986288334bd92d1400f11de39bcef"; logging-data="3296451"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19TsZj2dBgYzT5YAEhdgB5n" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:gxdqAdIBb+1sh31SPfimODBmkK8= sha1:3pf9kpBZwSw+gfhM8+oj0vlIoXk= Xref: csiph.com comp.unix.shell:25509 comp.unix.programmer:16168 comp.lang.misc:10761 Lawrence D'Oliveiro 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_truth As 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.com void Void(void) { Void(); } /* The recursive call of the void */