On Sun, 19 Jun 2005, Josiah Carlson wrote: > > Keith Dart <kdart at kdart.com> wrote: > >> Therefore, I would like to ask here if anyone has already started >> something like this? If not, I will go ahead and do it (if I have time). > > If all you need to do is read or write C-like types to or from memory, > you should spend some time looking through the 'struct' module if you > haven't already. I know about 'struct'. However, it will just convert to Python "native" types. C unsigned become Python longs. u = struct.pack("I", 0xfffffffe) struct.unpack("I", u) (4294967294L,) In SNMP, for example, a Counter32 is basically an unsigned int, defined as "IMPLICIT INTEGER (0..4294967295)". One cannot efficiently translate and use that type in native Python. Currently, I have defined an "unsigned" type as a subclass of long, but I don't think that would be speed or storage efficient. On the other hand, adding my own type won't help with the ioctl() problem, since it won't know about it. -- -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Keith Dart <kdart at kdart.com> public key: ID: F3D288E4 =====================================================================
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4