Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function definitions don't use the proper namespace in the IPython shell #280

Open
asmeurer opened this issue Oct 14, 2017 · 0 comments
Open

Comments

@asmeurer
Copy link
Collaborator

@asmeurer asmeurer commented Oct 14, 2017

For instance, if you run

a = 1

and

def test():
    print(a)

test()

in the IPython shell, it gives NameError: name 'a' is not defined.

The use of SetPropagatingDict would fix this. It looks like the IPython shell is doing some weird stuff, so I'm not exactly clear on how to fix this.

Also we should update the docs for SetPropagatingDict to make it clear that basically every shell should use it, unless they really know what they are doing. This is because globals/locals being separate dictionaries creates odd behavior with exec (basically, it acts like a class body), which is generally much different from what you would expect from a shell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.