Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #42280 > unrolled thread
| Started by | MRAB <python@mrabarnett.plus.com> |
|---|---|
| First post | 2013-03-29 21:24 +0000 |
| Last post | 2013-03-29 21:24 +0000 |
| 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: dir() vs print(dir()) in the embedded mode MRAB <python@mrabarnett.plus.com> - 2013-03-29 21:24 +0000
| From | MRAB <python@mrabarnett.plus.com> |
|---|---|
| Date | 2013-03-29 21:24 +0000 |
| Subject | Re: dir() vs print(dir()) in the embedded mode |
| Message-ID | <mailman.3966.1364592269.2939.python-list@python.org> |
On 29/03/2013 21:04, Nick Gnedin wrote: > > Folks, > > I have a newbie question: I am trying to embed Python into my > application. While playing around, I noticed that the behavior of the > interpreter in the embedded mode differs from the standalone one. > > Namely, in the standalone mode if I type dir(), I get a list of build-in > symbols. In the embedded mode only print(dir()) does that, while just > dir() returns silently. > > Is there a way to intercept the output of dir() (and all other commands) > and display them to the user? > > Here is an example code that illustrates the behavior (the first call to > PyRun_SimpleString() returns silently). > > Many thanks for your future hints, > dir() doesn't print anything, it just returns a list. It's the interactive interpreter that's printing the result, unless it's None.
Back to top | Article view | comp.lang.python
csiph-web