From: Roger B. <ro...@ro...> - 2004-01-06 00:25:03
|
> I store the ID code as the original hex string, That is a really bad idea! What is the difference between the following: 005ac 5ac 5Ac 05aC It will use less memory and be quicker to access if the internals use pure integers! > Hey, I got one right! :-) LoL Wait for a year, and then look at the code you wrote. I always get embarrassed by my old code. But hey, it even happens to Linus :-) http://lkml.org/lkml/2003/12/22/137 > I suppose an alternate approach would be to always consider a line for > it's matching as as a new vendor or new class line, and just interpret > each subline according to the last major entry type you saw... yeah, > that's it... ;-) Then we don't care about blank lines or comments. > This is now implemented and sees to work properly. The usual way of implementing this sort of thing is a state machine which is what it seems like you have done. The error cases and some of the transitions get really tricky :-) > Okay, I will do this and also just expand on how a line is handled and > be more rigorous about end-of-line trimming, removing all \n and \r > characters at the end of the line before doing a pattern match on it. That will work. > I thought of that, and thought you would have a "internet" database > object and "bitpim" database object. If you fail to find it in the > internet db you would consult the bitpim object. The search actually needs to be the other way. For example the Internet database has things like "Prolific 2303 USB serial bridge" when we want to display "FutureDial USB to serial cable for LGVX1/VX10/VX4400 (Prolific PL2303)" > Yes, but I like the (), as it helps me focus. LOL I always prefer less code and punctuation, except when there is ambiguity. > Any other suggestions for the module, or is it pretty much OK now? :-) Other than the keys you use should be integers throughout, epydoc reported this: ======================================================= C:\projects\bitpim\usb_ids.py In usb_ids.VendorList docstring (line 190): ------------------------------------------------------- L192: Error: Improper paragraph indentation. pychecker is happy. I'll get around to hooking it into the browser at some point. A one line change also results in modems being listed on Windows in comscan. Unfortunately more code will be needed since it will currently consider the modem interface valid for the 4400/6000 which it certainly isn't. Roger |