Re: how to get "self" in callback function
Thomas Stover <[email protected]>
| Newsgroups | gmane.comp.python.ctypes |
|---|---|
| Message-ID | <[email protected]> |
You can actually mix instance methods (class methods with self pointers) and regular methods from the stand point of C. I do all the time for the reasons you describe. When you use the C api for python, there is a function that calls python functions. The structure / object for those python functions has information in it like the self pointer. It's a different concept than a c function pointer. So to think of it another way, when you let ctypes wrap a python function (even an instance one with a self pointer) as a C function pointer - ctypes is really putting a shim function in the middle. I don't have access to the right computers in front of me, but I'll hunt down an example if you need one when I do. -- www.thomasstover.com ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo