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

Robert Kern robert.kern at gmail.com
Thu Jan 27 19:38:20 EST 2011

On 2011-01-26 17:00 , Gael Varoquaux wrote:
> 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.

That's not quite true. It's considered to be the module's docstring and is 
present as the .doc attribute on the Module object. I think that we could safely 
handle the case where ast.doc is not None by prepending 0 to the list of line 

I'm having trouble pushing a branch to my github at the moment, but attached is 
a patch. It completely fixes the "asdf" case, and 
split_blocks('"""foo\nbar"""\n') works correctly too, but in the actual IPython 
prompt, the multiline string does not get displayed or collected into the Out 
history. There may be a problem elsewhere.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: asdf-split.diff
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20110127/91df92d1/attachment.ksh>

More information about the IPython-dev mailing list