Hi guys,
now you can relax; this is my last submission.
It contains some wishes for a next release.
The Candidates Buglet

This buglet is not a real error but an example of poor programming style,
which makes the life of the application programmer more difficult than necessary.

Python is an object oriented language and the natural data type of the library candidates is the dictionary.

Since the days of Pascal we have learned, that it is a bad idea to litter program text with literals.

So put the candidates into a dictionary and export it to the application.

We have also learned in the Kindergarten that data belong into files and not into the program.

So provide a resource file with a dictionary-friendly structure to define the candidates;

something like:

libusb1:libusb-1.0.0,Libusb 1,usb

During initialization you should try to read this file and load the dictionary..

With this file you can fine tune the library search to the extend that only one library is to be used.

This would make the lambda quirk superfluous.

If you start the file search at the default directory you can define a dedicated library for each device.

Apropos lambda:

did you ever think of who sits at the far end of the USB cable?

Most probably it is an electronics engineer with a programming background of copying arduino sketches to his files.

Why should this guy have to change a program only to pass a string to pyusb?

And in a lambda _expression_!

Even after some 10000 lines of python I have not understood how to use it.

Do not even dream of explaining to a hardware guy what lambda is!

If you want to keep the possibility of supplying the library name you should provide an easier way.

Simply permit a string as the backend= parameter which names the library.

And it would be nice to have a utility function find_installed_library.
So I want to thank you all for your patience in improving my understanding of this matter.
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
pyusb-users mailing list

Reply via email to