[IPython-user] demo, classes and indentation
Wed Sep 3 23:30:12 CDT 2008
On Tue, Sep 2, 2008 at 11:33 PM, Stefan Schwarzburg
> Dear all,
> I have a question about the demo mode:
> Is it possible to run a demo that includes classes? Whenever I try to run
> such a demo, the indentation is missing at each block (which makes it
> unusable for classes...).
> Can someone help me here?
Unfortunately I'm afraid the demo stuff has fallen into a bit of
disrepair. I hadn't used it in a while and I recently noticed
problems with it. We're trying to wrap up the 0.9 release, but I have
some teaching to do soon and I'll try to fix it as soon as I can,
adding proper tests in the process. I'll keep this in mind as I do
so, because it's likely a problem that was simply never addressed.
One note though: you simply can't break up the sections of a demo
anywhere but at the top-level of indentation, so there's just no way
to have a section include only part of a class or function
declaration. That's just a limitation of python's indentation-based
model. So for your demos, you need to keep the split points at the
top-level, keeping classes or functions *entirely* within one demo
block. That limitation could technically be removed, but it's not
trivial (it requires keeping an internal running block to which you
add new sections that are indented and *re-execute* the accumulated
contents to gradually complete the code).
More information about the IPython-user