From: cl@isbd.net   
      
   Lawrence D’Oliveiro wrote:   
   > On Sat, 30 Aug 2025 09:02:46 +0100, Chris Green wrote:   
   >   
   > > Lawrence D’Oliveiro wrote:   
   > >>   
   > >> On Thu, 28 Aug 2025 19:05:55 +0100, Chris Green wrote:   
   > >>   
   > >>> The best I've found so far is the 'source':-   
   > >>> https://github.com/brgl/libgpiod/blob/master/bindings/   
   ython/README.md   
   > >>>   
   > >>> It has some Python examples but the coding style is very odd and   
   > >>> makes it difficult to follow what's going on IMHO.   
   > >>   
   > >> I had a look at one or two examples, but they didn’t look very   
   > >> “odd” to me. Any particular ones you are having trouble with?   
   > >   
   > > I worked it all out OK, I do write quite a lot of Python code. My   
   > > comment was rather that the style using 'with' and so on which makes   
   > > it rather diffcult to actually follow the sequence of calls required   
   > > to do simple things like 'set this line high' or 'read the state of   
   > > that line'.   
   >   
   > You don’t know about context managers? They’re a basic Python   
   > mechanism for ensuring proper cleanup. You consider it “odd” just   
   > because you hadn’t learned about that feature of Python?   
      
   Look, I'm a software engineer (Eur. Ing., FEANI) with well over 50   
   years of programming experience in all sorts of languages.   
      
   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. 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.   
      
   Someone unfamiliar with Python and/or someone who is not an   
   experienced programmer is much more likely to be the audience for   
   these examples. The more professional/skilful people will probably   
   simply dive in to the API documentation.   
      
      
   --   
   Chris Green   
   ·   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|