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