From: Hermann H. <her...@we...> - 2016-10-13 09:47:45
|
<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div> <div>Hi guys,</div> <div>now you can relax; this is my last submission.</div> <div>It contains some wishes for a next release.</div> <div> </div> <div>--------------------------------</div> <div> </div> <div><u>The Candidates Buglet</u></div> <div><br/> This buglet is not a real error but an example of poor programming style,<br/> which makes the life of the application programmer more difficult than necessary.<br/> <br/> Python is an object oriented language and the natural data type of the library candidates is the dictionary.<br/> <br/> Since the days of Pascal we have learned, that it is a bad idea to litter program text with literals.<br/> <br/> So put the candidates into a dictionary and export it to the application.<br/> <br/> We have also learned in the Kindergarten that data belong into files and not into the program.<br/> <br/> So provide a resource file with a dictionary-friendly structure to define the candidates;<br/> <br/> something like:<br/> <br/> libusb1:libusb-1.0.0,Libusb 1,usb<br/> <br/> …<br/> <br/> During initialization you should try to read this file and load the dictionary..<br/> <br/> With this file you can fine tune the library search to the extend that only one library is to be used.<br/> <br/> This would make the lambda quirk superfluous.<br/> <br/> If you start the file search at the default directory you can define a dedicated library for each device.<br/> <br/> <br/> Apropos lambda:<br/> <br/> did you ever think of who sits at the far end of the USB cable?<br/> <br/> Most probably it is an electronics engineer with a programming background of copying arduino sketches to his files.<br/> <br/> Why should this guy have to change a program only to pass a string to pyusb?<br/> <br/> And in a lambda expression!<br/> <br/> Even after some 10000 lines of python I have not understood how to use it.<br/> <br/> Do not even dream of explaining to a hardware guy what lambda is!<br/> <br/> If you want to keep the possibility of supplying the library name you should provide an easier way.<br/> <br/> Simply permit a string as the backend= parameter which names the library.<br/> <br/> And it would be nice to have a utility function find_installed_library.</div> <div> </div> <div>----------------------</div> <div> </div> <div>So I want to thank you all for your patience in improving my understanding of this matter.</div> <div> </div> <div>Hermann</div> <div> </div> <div><img height="150" src="cid:5f011b9a62cc6dd460c0b73b81e74086cbd2f3a3f74c170f8de36436f5b4b62a" width="200"/></div> </div></div></body></html> |