Is device a list/tuple?
device
is a usb.core.Device
. Iterating over it yields configurations.
If yes, how does this code check all the devices by executing
if device.bDeviceClass == self._class:
just once?
It doesn't. You missed the part that says "So, to really find all printers connected to the system, we would need to transverse all configurations, and then all interfaces and check if one of the interfaces has its bInterfaceClass field equal to 7.".
what is happening in this line:
self._class = class
_
Exactly what it says. It's binding the object in that argument to that attribute. For later use.
why is the class find_class never instantiated in
printers = usb.core.find(find_all=1, custom_match=find_all(7))
Because someone had a thinko. That last part should be ...=find_class(7)
.