Last active
February 22, 2018 02:09
-
-
Save thebabush/c83bb61a1b656113da4cbd34df0fc6d7 to your computer and use it in GitHub Desktop.
Run IPython.embed() inside Cython
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Cython/pyximport don't work 100% with the `inspect` module. | |
# For this reason, `IPython.embed()` is not able to get the locals from the current frame. | |
# This is how to work around that | |
import IPython | |
def embed(locs): | |
# Pass the locals explicitly | |
IPython.embed(user_ns=locs) | |
# Usage | |
embed(locals()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment