summaryrefslogtreecommitdiff
path: root/writing_python_scripts
diff options
context:
space:
mode:
authorNishanth Amuluru2010-10-12 11:44:33 +0530
committerNishanth Amuluru2010-10-12 11:44:33 +0530
commite029f60f1a5254f12b32a62e9a00947dcfc16aa5 (patch)
tree6bb19d11f6d53ffa25c91dad624030fe2f0260fd /writing_python_scripts
parentc0466f911b7cf30ef64c84788d2fea06ff2e1a43 (diff)
downloadst-scripts-e029f60f1a5254f12b32a62e9a00947dcfc16aa5.tar.gz
st-scripts-e029f60f1a5254f12b32a62e9a00947dcfc16aa5.tar.bz2
st-scripts-e029f60f1a5254f12b32a62e9a00947dcfc16aa5.zip
Finished writing_python_scripts
Diffstat (limited to 'writing_python_scripts')
-rw-r--r--writing_python_scripts/quickref.tex14
-rw-r--r--writing_python_scripts/script.rst7
2 files changed, 13 insertions, 8 deletions
diff --git a/writing_python_scripts/quickref.tex b/writing_python_scripts/quickref.tex
index a0212b3..2b24fc9 100644
--- a/writing_python_scripts/quickref.tex
+++ b/writing_python_scripts/quickref.tex
@@ -1,11 +1,9 @@
-Creating a tuple:\\
-{\ex \lstinline| t = (1, "hello", 2.5)|}
+See where python searches for modules:\\
+{\ex \lstinline| sys.path|}
-Accessing elements of tuples:\\
-{\ex \lstinline| t[index] Ex: t[2]|}
+Include our own path in PYTHONPATH:\\
+{\ex \lstinline| sys.path.append(our_path)|}
-Accessing slices of tuples:\\
-{\ex \lstinline| t[start:stop:step]|}
+Run certian code only if executed and not if imported:\\
+{\ex \lstinline| if __name__=="__main__": #do something|}
-Swapping values:\\
-{\ex \lstinline| a, b = b, a|}
diff --git a/writing_python_scripts/script.rst b/writing_python_scripts/script.rst
index d8268f4..07c91f1 100644
--- a/writing_python_scripts/script.rst
+++ b/writing_python_scripts/script.rst
@@ -1,8 +1,15 @@
.. Objectives
.. ----------
+.. By the end of this tutorial, you will be able to
+
+.. * Understand what is importing
+.. * Write your own Python modules
+.. * Understand the ``__name__=="__main__"`` idiom
+
.. Prerequisites
.. -------------
+.. 1. Using Python modules
.. Author : Nishanth Amuluru
Internal Reviewer :