[IPython-dev] No displayhook triggered for raw 'asdf'

Gael Varoquaux gael.varoquaux at normalesup.org
Wed Jan 26 18:00:20 EST 2011


On Wed, Jan 26, 2011 at 05:54:22PM -0500, Fernando Perez wrote:
> I'm not familiar with that code, which R. Kern originally wrote, so I
> haven't found a solution yet.  If anyone can pitch in who knows those
> AST manipulations well, it would be great.  I'll keep hammering on it.

AFAIK comments and equivalent (a single string is considered as a
comment) are not represented in the AST. I struggled with that in
pyreport (no use to look at the pyreport code: I don't think that it is
useable for you). I think that the way out it to use a combination of the
tokenizer and the AST to identify such trouble makers before feeding them
to the AST. It gets nasty.

> BTW, I have no clue as to why it's not happening on the py3k branch,
> that's quite odd.

In py3k, I believe that the underlying notion is that of a CST: 'concrete
syntax tree', that keeps extra information, such as the comments or
blocks made of strings. It was introduced for code manipulations.

I hope I haven't inserted too many factual mistakes above :)

Gaël



More information about the IPython-dev mailing list