Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: rbowman Newsgroups: comp.os.linux.misc,alt.folklore.computers Subject: Re: Python Date: 20 Dec 2025 05:37:35 GMT Lines: 52 Message-ID: References: <10fvcgr$3d6mu$1@paganini.bofh.team> <10g526s$3o78s$1@dont-email.me> <10ga7mg$7ph$3@news.misty.com> <10gekt9$39ian$4@dont-email.me> <10gfihn$3lshj$1@dont-email.me> <10gh6oj$83hq$8@dont-email.me> <10ghqrq$g7pg$1@dont-email.me> <693d5437$0$2499$426a34cc@news.free.fr> <7a611mx9gf.ln2@Telcontar.valinor> <693ea5fa$0$28070$426a74cc@news.free.fr> <6945bc2b$0$11457$426a34cc@news.free.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net 2GHUzaqr6448j6dlkscphgK89UVEMiMqrIs+9myGnrmhgCTuSK Cancel-Lock: sha1:yYeWE6W3GiXA9YHY/19jyLRKv9w= sha256:3eVGgUgIbd+Tzqhk/OwIK2YIl2XUODvFT9t6m/a1H3g= User-Agent: Pan/0.162 (Pokrosvk) Xref: csiph.com comp.os.linux.misc:79540 alt.folklore.computers:232719 On Fri, 19 Dec 2025 22:09:45 +0000, Richard Kettlewell wrote: > Stéphane CARPENTIER writes: >> It's not my issu. Vim is able to comment blocks of code without issue. >> It's python that can't always manage it. Let say I have that part of >> code: >> >> if test1: >> if test2: >> do some stuff >> >> If I comment the second line to see what happens if I remove my test2, >> like I would do with any normal language, then with python it just >> doesn't work because it breaks the indentation. > > $ cat t.py test1=True test2=False > > if test1: > if test2: > print("L6") > > if test1: > #if test2: > print("L10") > $ python3 t.py L10 $ ruff check t.py All checks passed! $ ruff format t.py 1 file reformatted ruff did move the print(("L10") out so you wouldn't want to format the file. Removing the # from the formatted file without fixing the indentations gives $ ruff check t.py invalid-syntax: Expected an indented block after `if` statement --> t.py:10:5 | 8 | if test1: 9 | if test2: 10 | print("L10") | ^^^^^ Stéphane doesn't like Python; I don't like Personal Home Page. We all have our tastes.