[IPython-dev] Changes to Notebook Format

Tzanko Matev tsanko at gmail.com
Mon Jul 18 05:18:43 CDT 2005


Hi all,

I would like to suggest a few changes to the ipython-log part of the
notebook format. I think that the following structure might be better:

<ipython-log logid="default-log">

<element id="1">
<input type="normal">
def foo(x, y):
    return x + y
</input>
</element>

<element id="2">   
<input type="normal">
foo(3, 4)
</input>
<output type="normal">
7
</output>
</element>

</ipython-log>

The input tags can have types "normal" and "special" which correspond to
the tags <input> and <special-input> of the current format. The output
tags can have types "normal", "stdout", "figure", etc. One input tag can
have several corresponding output tags with different types. I think
that the resulting ElementTree object would be more useful that way. In
order to parse a file of the current format I need to create its
corresponding ElementTree object and then I must make my own data
representation from that object, because searching for tags with XPath
is slow and with the current format there is no easier way to retrieve
the text I need. With the proposed format I don't really need another
internal data rpresentation, which would make my code cleaner.

Also with the new format we won't really need the id argument which will
make the format less error-prone.

Tzanko




More information about the IPython-dev mailing list