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,710 of 135,536   
   =?UTF-8?Q?St=C3=A9phane?= CARPENTIE to All   
   Re: Python   
   20 Dec 25 13:32:47   
   
   XPost: alt.folklore.computers   
   From: sc@fiat-linux.fr   
      
   Le 20-12-2025, Nuno Silva  a écrit :   
   > 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?   
      
   I'm happy to see I'm not the only one unable to answer that question for   
   sure. I really believed my example was a complete minimal example   
   without checking it when I posted it. And when I saw his answer, I had   
   to check it. And, yes, I saw: it works. And that's exactly what I'm   
   saying when I say that real life examples don't work anymore when using   
   beginners examples. There is a huge gap between the python sold as easy   
   to understand for beginners and the python that works fine for experts.   
   And pretending python is good for beginners because it works fine for   
   experts is just a lie.   
      
   I'm not a python expert and I have neither time nor will to become one.   
      
   --   
   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