Eliminate / replace remaining cPickle references in test scripts.
[scons.git] / doc / user / python.xml
1 <!--
2
3   __COPYRIGHT__
4
5   Permission is hereby granted, free of charge, to any person obtaining
6   a copy of this software and associated documentation files (the
7   "Software"), to deal in the Software without restriction, including
8   without limitation the rights to use, copy, modify, merge, publish,
9   distribute, sublicense, and/or sell copies of the Software, and to
10   permit persons to whom the Software is furnished to do so, subject to
11   the following conditions:
12
13   The above copyright notice and this permission notice shall be included
14   in all copies or substantial portions of the Software.
15
16   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17   KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18   WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20   LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21   OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22   WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
24 -->
25
26   <!--
27
28   <section>
29   <title>Python Overview</title>
30
31     <para>
32
33     This section will provide a brief overview of
34     the Python programming language.
35     Skip this section if you are already familiar with Python
36     (or you're really intent on diving into &SCons;
37     and just picking up things as you go).
38
39     </para>
40
41     <para>
42
43     Python has a lot of good
44     documentation freely available on-line
45     to help you get started.
46     The standard tutorial is available at XXX.
47
48
49     </para>
50
51     <para>
52
53     Python is very easy to pick up.
54
55     </para>
56
57     <para>
58
59     Python variables must be assigned to before they can be referenced.
60
61     </para>
62
63     <para>
64
65     Assignment is like most programming languages:
66
67     x = 1 + 2
68     z = 3 * x
69
70     </para>
71
72     <para>
73
74     Function calls look like most language function calls:
75
76     a = f(g)
77
78     </para>
79
80     <para>
81
82     Define functions like so:
83
84         def func(arg1, arg2):
85             return arg1 * arg 2
86
87     The number of parameters
88
89     </para>
90
91     <para>
92
93     Strings can be enclosed in single quotes or double quotes,
94     backslashes are used to escape characters,
95     triple-quote syntax lets you include quotes and newlines,
96     raw strings begin with 'r'.
97
98     </para>
99
100     <para>
101
102     Lists are enclosed in square brackets,
103     list items are separated by commas.
104     List references use square brackets and integer index values,
105     slice notation lets you select, delete or replace a range.
106
107     </para>
108
109     <para>
110
111     Dictionaries (hashes) are enclosed in curly brackets,
112     : separates keys from values,
113     , separates items.
114     Dictionary values are referenced using square brackets.
115
116     </para>
117
118     <para>
119
120     Access class attributes (including methods) using a '.'.
121
122     </para>
123
124     <para>
125
126     if: statements look like
127
128     elif: statements look like
129
130     else: statements look like
131
132     </para>
133
134     <para>
135
136     for: statements look like
137
138     while: statements look like
139
140     break statements look like
141     
142     continue statements look like
143
144     </para>
145
146     <para>
147
148     pass
149
150     </para>
151
152   </section>
153
154   -->