On Jan 10, 2006, at 01:59, Luke Dunstan wrote: > I am interested to know why you prefer it. I can think of the > following > advantages: > > - It initialises RAPI the first time you try to use it, and > remembers this. > - It includes more file I/O functions. > > I'm sure it is good for some purposes, but I can also think of some > possible > disadvantages: > > - The functions are in a class instead of a module. This means that > you > could create multiple instances of the class, which doesn't make > sense.
Sure it does -- this is the way we use it around here. (I work with Brian, and write many of the ctypes style wrappers for our libraries.) We make multiple instances, and it works just fine. I believe RAPI tracks the number of times you init/uninit if I recall correctly. > - The name "pocketRapi" implies Pocket PC only but RAPI really > applies to > Windows CE in general. True, but a name can be easily changed. All the devices we work with are Pocket PCs, and it started as an internal module for our projects. > - It requires win32file. Just constants from win32file. We can easily eliminate that dependency. > - The file I/O functions do not follow the pattern of Python file > objects. True, and I'd love to see that implemented as well. I was in a rush to get something working, but we can modify this to make it work like normal. An alternative in the meantime is to use StringIO instances and pass those to copy file. Not quite as good, but functional. I was thinking this while I was writing, but I was challenged to get something functional out so we could finish the client app. ;) > - It doesn't include the last error codes in exceptions raised. We could add that. We used the ctypes errcheck protocol when we wrapped OpenAL, and it worked wonderfully. We also wrapped the entire header file natively using the gccxml tools, and then created a OO wrapper on top of it. This allows us to have both a module- level wrapper, and an OO style wrapper. > - It doesn't use "argtypes" or "restype". I don't know if this > makes it > faster? It worked without them... Doesn't bother me, and saved me the time in looking up the prototypes. More of a developer time optimization. ;) You'd have to ask Thomas about speed implications of argtypes and restypes though. > - Redistributions in "binary form" must reproduce the copyright > notice. That's pretty much the standard BSD style license -- ctypes MIT license is very similar, as well as pywin32's license... At least it's not GPL. ;) http://opensource.org/licenses/bsd-license.php Hopefully this gives us all good starting point for RAPI use. A refactor would be useful -- especially after trying some of Thomas' new tools like errcheck and gccxml. But for the mean time, I'll have to wait on it. Too many projects on the plate to revisit it now. Thanks, -Shane Holloway & Brian Brown TechGame Networks _______________________________________________ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce