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