On Thu, Dec 18, 2014 at 8:10 PM, Stefan Seefeld <ste...@seefeld.name> wrote: > That sounds a bit confusing to me. :-) > Typically, if you associate state with a callback (a "closure"), you > think of it as an object whose member function is the callback. But > here, the callback function lives in Python, while you want to associate > state from the C++ runtime...
Exactly! There may be a better way to do what I'm trying to do. The relationship is one-to-many (i.e. a single Python object can be associated with many C++ objects). Because of this relationship, I need some context in which the Python object is called in order to make sure each of the C++ objects is aware that the callback occurred. That is, I don't want numerous C++ objects triggering a callback into Python. That shared information (whether or not the Python callback occurred) must be stored somewhere. Since I have no control over the order those C++ objects are invoked (they are passed to a 3rd party library), so when the first one is invoked, it needs to notify the others not to do the Python callback. Anyway, as you noted, I figured something out. I'm sure there's a more clever way to do this. But I'm an EE converted to the software world and I'm probably not thinking like a software engineer. Thanks, Pete _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org https://mail.python.org/mailman/listinfo/cplusplus-sig