Hello,

I would like access to a hook inside Python that would allow me to
register a C++ function to be called periodically during the
evaluation of a Python script.

Does any such thing exist today in Python? I poked around but didn't
find anything.

I want to do this for interrupt handling. I'd like to be able to
interrupt long running Python commands. I have a hook which would
throw a C++ exception if an interrupt is detected. I would then catch
this at the place where my application which embeds Python invokes a
Python command. My hook is written to be very fast, so calling it
every Python instruction would not be that bad in terms of
performance.

I'd like to avoid changing the existing Python implementation, which
is why I'm looking for a hook. Otherwise, a user would not be able to
substitute in their own Python implementation if they so desire
instead of taking the default on our app uses.

Thanks for the ideas.

-William

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to