##// END OF EJS Templates
Added demo example to SVN
fperez -
Show More
@@ -0,0 +1,40 b''
1 """A simple interactive demo to illustrate the use of IPython's Demo class.
2
3 Any python script can be run as a demo, but that does little more than showing
4 it on-screen, syntax-highlighted in one shot. If you add a little simple
5 markup, you can stop at specified intervals and return to the ipython prompt,
6 resuming execution later.
7 """
8
9 print 'Hello, welcome to an interactive IPython demo.'
10 print 'Executing this block should require confirmation before proceeding,'
11 print 'unless auto_all has been set to true in the demo object'
12
13 # The mark below defines a block boundary, which is a point where IPython will
14 # stop execution and return to the interactive prompt.
15 # Note that in actual interactive execution,
16 # <demo> --- stop ---
17
18 x = 1
19 y = 2
20
21 # <demo> --- stop ---
22
23 # the mark below makes this block as silent
24 # <demo> silent
25
26 print 'This is a silent block, which gets executed but not printed.'
27
28 # <demo> --- stop ---
29 # <demo> auto
30 print 'This is an automatic block.'
31 print 'It is executed without asking for confirmation, but printed.'
32 z = x+y
33
34 print 'z=',x
35
36 # <demo> --- stop ---
37 # This is just another normal block.
38 print 'z is now:', z
39
40 print 'bye!'
General Comments 0
You need to be logged in to leave comments. Login now