Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #71819 > unrolled thread
| Started by | Chris Angelico <rosuav@gmail.com> |
|---|---|
| First post | 2014-05-21 03:55 +1000 |
| Last post | 2014-05-21 03:55 +1000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Loading modules from files through C++ Chris Angelico <rosuav@gmail.com> - 2014-05-21 03:55 +1000
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-05-21 03:55 +1000 |
| Subject | Re: Loading modules from files through C++ |
| Message-ID | <mailman.10164.1400608567.18130.python-list@python.org> |
On Wed, May 21, 2014 at 3:17 AM, Roland Plüss <roland@rptd.ch> wrote: > The important part are the last two lines. An important module is > lacking the __builtins__ dictionary member so I had to add it. > > Hopefully this works also in Py3 should I switch some time later. But I > guess it should seeing how simple the import now became. An interesting omission, I'm a little surprised at that. But if your switch to Py3 is a serious (or even half-serious) possibility, I recommend tossing a quick comment against that line of code. Check to see if you actually need it, and if you still do, see if there's a change there. The module has been renamed (from __builtin__ to builtins, although the global reference to it is still __builtins__), so you may need to adjust something there, too. But mainly, see if you can drop that line of code in Py3. > Furthermore I had to call the string runner with moduleDict both as > global and local dictionary. With that change the virtual script is > properly loaded and working as it should. This part does make sense, though. Normally, module-level code runs with the same locals and globals: >>> locals() is globals() True And that doesn't change in Py3, so I would expect that your C++ code also won't change. ChrisA
Back to top | Article view | comp.lang.python
csiph-web