annotate docs/pycon2010/pycon2010.rst @ 337:2ce34ad4e520

begin Pycon talk
author catherine@Drou
date Tue, 16 Feb 2010 11:02:56 -0500
parents
children 4300ef912f4a
rev   line source
337
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
1 py 3
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
2
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
3 Web 2.0
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
4 =======
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
5
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
6 .. image:: web-2-0-logos.gif
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
7 :height: 300 px
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
8
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
9 But first...
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
10 ============
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
11
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
12 .. image:: sargon.jpg
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
13 :height: 300 px
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
14
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
15 Sargon the Great founded the Akkadian Empire
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
16 in the twenty-third century BC.
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
17
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
18 In between
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
19 ==========
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
20
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
21 .. image:: apple.jpg
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
22 :height: 300 px
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
23
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
24 Unlike the Akkadian Empire, the CLI will never disappear.
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
25
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
26 line-oriented command interpreter
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
27 command-line interface
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
28 text user interface
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
29 terminal user interface
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
30 console
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
31 shell
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
32
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
33 Defining
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
34 ========
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
35
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
36 Prompt accepts free text input
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
37 Outputs lines of text
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
38 CLI environment persists
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
39
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
40 Examples
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
41 ========
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
42
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
43 Bash, Korn, zsh
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
44 Python shell
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
45 screen
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
46 Zork
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
47 ed
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
48 SQL clients: psql, SQL*\Plus, mysql...
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
49
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
50 != Command Line Utilities
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
51 =========================
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
52
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
53 Accept single set of arguments at
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
54 invocation, execute, terminate
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
55
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
56 dir
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
57 grep
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
58 ping
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
59
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
60 sys.argv
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
61 optparse
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
62
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
63 != Text User Interfaces
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
64 =======================
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
65
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
66 ("console")
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
67
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
68 Use entire (session) screen
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
69 Not line-by-line
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
70
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
71 .. image:: urwid.png
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
72 :height: 300px
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
73
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
74 curses
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
75 urwid
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
76
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
77
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
78 foo a b c ->
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
79 self.do_foo('a b c')
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
80 self.default('foo a b c')
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
81
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
82 pirate.py
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
83 =========
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
84
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
85 ::
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
86
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
87 from cmd import Cmd
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
88
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
89 class Pirate(Cmd):
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
90 pass
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
91
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
92 pirate = Pirate()
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
93 pirate.cmdloop()
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
94
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
95 history: cursor
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
96 ctrl-r
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
97 help
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
98