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,705 of 135,536   
   Nuno Silva to Richard Kettlewell   
   Re: Python   
   20 Dec 25 11:45:08   
   
   XPost: alt.folklore.computers   
   From: nunojsilva@invalid.invalid   
      
   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?   
      
   --   
   Nuno Silva   
      
   --- 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