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,591 of 135,536   
   Richard Kettlewell to Dan Espen   
   Re: Python   
   17 Dec 25 22:13:21   
   
   XPost: alt.folklore.computers, comp.lang.python   
   From: invalid@invalid.invalid   
      
   Dan Espen  writes:   
   > Lawrence D’Oliveiro  writes:   
   >> On Mon, 15 Dec 2025 12:57:57 +0000, mm0fmf wrote:   
   >>> On 14 Dec 2025 11:56:42 GMT, Stéphane CARPENTIER wrote:   
   >>>> My issues with python are:   
   >>>> - It's using indentations, so when I comment a block of code to see   
   >>>>   what happens, it breaks everything and I have to manage the   
   >>>>   indentations. I can't just comment/uncomment a block of code as I do   
   >>>>   with other programming languages.   
   >>> ''' and ''' are your friend   
   >>   
   >> Unless the block has triply-quoted strings inside it ...   
   >   
   > Then """ and """ are your better friends.   
      
   Why bother? If you want to comment out a block, you can do just that,   
   much the same as in any other language.   
      
       $ cat t.py   
       def f(x):   
       #    while x < 10:   
       #        print(x)   
       #        x += 1   
           print("done")   
      
       f(3)   
       $ python3 t.py   
       done   
      
   If you prefer the comment markers to match the indentation of the whole   
   block, that works too:   
      
       $ cat t.py   
       def f(x):   
           # while x < 10:   
           #     print(x)   
           #     x += 1   
           print("done")   
      
       f(3)   
       $ python3 t.py   
       done   
      
   Or perhaps you prefer the comment markets to follow the lines they’re   
   commenting out:   
      
       $ cat t.py   
       def f(x):   
           # while x < 10:   
               # print(x)   
               # x += 1   
           print("done")   
      
       f(3)   
       $ python3 t.py   
       done   
      
   --   
   https://www.greenend.org.uk/rjk/   
      
   --- 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