Title: IPythonShellEmbed fails to recognize local variables · Issue #136 · ipython/ipython · GitHub
Open Graph Title: IPythonShellEmbed fails to recognize local variables · Issue #136 · ipython/ipython
X Title: IPythonShellEmbed fails to recognize local variables · Issue #136 · ipython/ipython
Description: Issue Embedded IPython shells can lose track of local variables. Test Case Minimal test case: class Foo(object): """ Container-like object """ def __setattr__(self, obj, val): self.__dict__[obj] = val def __getattr__(self, obj, val): ret...
Open Graph Description: Issue Embedded IPython shells can lose track of local variables. Test Case Minimal test case: class Foo(object): """ Container-like object """ def __setattr__(self, obj, val): self.__dict__[obj] = ...
X Description: Issue Embedded IPython shells can lose track of local variables. Test Case Minimal test case: class Foo(object): """ Container-like object """ def __setattr__(self, ob...
Opengraph URL: https://github.com/ipython/ipython/issues/136
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"IPythonShellEmbed fails to recognize local variables","articleBody":"# Issue\n\nEmbedded IPython shells can lose track of local variables.\n# Test Case\n\nMinimal test case:\n\n```\nclass Foo(object):\n \"\"\" Container-like object \"\"\"\n def __setattr__(self, obj, val):\n self.__dict__[obj] = val\n\n def __getattr__(self, obj, val):\n return self.__dict__[obj]\n\nf = Foo()\nf.indices = set([1,2,3,4,5])\nf.values = {}\nfor x in f.indices:\n f.values[x] = x\n\ndef bar(foo):\n import IPython\n IPython.Shell.IPShellEmbed()()\n return sum(foo.values[x] for x in foo.indices)\n\nprint bar(f)\n```\n\nTo see the error, first run the code in Python (or IPython) and exit from the spawned shell; the final print statement correctly displays '15'. Run the code again, but this time type `sum(foo.values[x] for x in foo.indices)` in the spawned shell, and we receive the error \n\n\u003e \" NameError: global name 'foo' is not defined\".\n","author":{"url":"https://github.com/prsteel","@type":"Person","name":"prsteel"},"datePublished":"2010-07-19T20:26:34.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":21},"url":"https://github.com/136/ipython/issues/136"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:661b98ff-4f18-38e4-e0e7-70f1062f981f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C4D4:951F5:2048839:2ECC8C9:6A4D0967 |
| html-safe-nonce | 0b404981b0cec9b6866ccffe83f601d105ddd83318655a8494bf662c6618b8cf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNEQ0Ojk1MUY1OjIwNDg4Mzk6MkVDQzhDOTo2QTREMDk2NyIsInZpc2l0b3JfaWQiOiI3NjcxNDIzNjI1Mjc5MTEzNTc1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 68ff62b6010eece2f1c9d9490b860e74a29760c05b2a4cb3b06258d2e6f55468 |
| hovercard-subject-tag | issue:253014 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/ipython/ipython/136/issue_layout |
| twitter:image | https://opengraph.githubassets.com/69049fa0340f17dc69ed6671112578cd0ee4e6ca16bc8d70d654fc9b908b5487/ipython/ipython/issues/136 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/69049fa0340f17dc69ed6671112578cd0ee4e6ca16bc8d70d654fc9b908b5487/ipython/ipython/issues/136 |
| og:image:alt | Issue Embedded IPython shells can lose track of local variables. Test Case Minimal test case: class Foo(object): """ Container-like object """ def __setattr__(self, obj, val): self.__dict__[obj] = ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | prsteel |
| hostname | github.com |
| expected-hostname | github.com |
| None | 31e4db13a9e20081f2fac78f441659a6576e582bbb15e153f9c7fb6473aa29f5 |
| turbo-cache-control | no-preview |
| go-import | github.com/ipython/ipython git https://github.com/ipython/ipython.git |
| octolytics-dimension-user_id | 230453 |
| octolytics-dimension-user_login | ipython |
| octolytics-dimension-repository_id | 658518 |
| octolytics-dimension-repository_nwo | ipython/ipython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 658518 |
| octolytics-dimension-repository_network_root_nwo | ipython/ipython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | fb70bd3c4b2bec429781b65419e912c66e2d5581 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width