home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.os.linux.misc      Linux-specific topics not covered by oth      135,536 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 133,700 of 135,536   
   =?UTF-8?Q?St=C3=A9phane?= CARPENTIE to All   
   Re: Python   
   20 Dec 25 10:34:27   
   
   XPost: alt.folklore.computers   
   From: sc@fiat-linux.fr   
      
   Le 19-12-2025, Richard Kettlewell  a écrit :   
   > 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   
      
   OK, so it works with your example and it doesn't with more nested   
   loops/if and I don't know when it will work and when it won't. So, it's   
   exactly my issue with python: that works when expected except when that   
   doesn't and I don't know why/when.   
      
   --   
   Si vous avez du temps à perdre :   
   https://scarpet42.gitlab.io   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca