XPost: alt.folklore.computers   
   From: invalid@invalid.invalid   
      
   Nuno Silva writes:   
   > On 2025-12-19, 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   
   >   
   > Doesn't this only work if there are no statements directly under "if   
   > test1:" besides the second conditional?   
      
   Indeed, but that’s not the example Stéphane gave. It’s tricky to debug   
   someone’s problem if they don’t describe it accurately.   
      
   A more general solution would be to force the condition to False, e.g.:   
      
    if test1:   
    if False or test2:   
    stuff...   
    more stuff...   
      
   --   
   https://www.greenend.org.uk/rjk/   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|