wrapping C pointers
spamtrap at bigfoot.com
Mon Jan 12 12:56:00 CET 2004
What's the preferred way to wrap handles to C structures in python?
(opaque 32-bit pointers with LSBs=00, that python should never deref)
Convert directly to PyLong? (seems most natural, although python longs
are quite heavy-weight).
Shift right and convert to PyInt? (might result in a bit smaller & faster
python object, but does it really pay off?)
Convert to hexadecimal string? (looks horrible, but SWIG uses that
by default, and the author claims it's faster than embedding the pointer
inside CObjects. (?!?)
CObject? Would provide type information + simple-to-add C methods, but
I don't really need that right now, especially if it's slower than
Anyone ran some tests? What python types people use in their wrappers?
More information about the Python-list