home bbs files messages ]

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

   comp.sys.raspberry-pi      Raspberry Pi computers & related hardwar      26,127 messages   

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

   Message 25,620 of 26,127   
   Lawrence =?iso-8859-13?q?D=FFOlivei to Chris Green   
   Re: Has gpio changed completely betwen b   
   30 Aug 25 23:01:15   
   
   From: ldo@nz.invalid   
      
   On Sat, 30 Aug 2025 13:42:52 +0100, Chris Green wrote:   
      
   > Yes, context managers are a 'good thing' but using them to help   
   > **understand** how the basics of a package work is not, IMHO, a good   
   > idea.   
      
   It is in fact quite a common thing. Look at the examples of use   
   of the open() function in the standard Python library docs   
   , for instance.   
      
   There is another call to open() on that page, in an example for another   
   function, and that uses a with-statement too.   
      
   > First show how to do something **then** emphasise that you   
   > must release resources and say that using a context manager is one   
   > way of doing it.   
      
   This is the old “do as I say, not as I do” school of writing example code.   
   You tell people to understand what the code does and use it as a model,   
   not just blindly copy-and-paste, and ... guess what they do?   
      
   > Someone unfamiliar with Python and/or someone who is not an   
   > experienced programmer is much more likely to be the audience for   
   > these examples.   
      
   In other words, precisely the ones who are in a hurry to get something   
   done, finish an assignment or whatever, and therefore ... blindly copy-   
   and-paste.   
      
   > The more professional/skilful people will probably simply dive in to the   
   > API documentation.   
      
   One would hope so, but given some discussions that have been happening   
   recently, I’m not so sure ...   
      
   --- 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