summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPuneeth Chaganti2010-05-18 15:27:05 +0530
committerPuneeth Chaganti2010-05-18 15:27:05 +0530
commit03ea7ab107425851aca14b3d187a5813cdf16709 (patch)
treed6aaa7b0207cbf17088d8c5396413d950accc964
parent1199e1d43a8b23144b516a7425c20b8bbf36723d (diff)
parentb4a6ef0ac9b27d040c97bc6eb5bd99ed56246373 (diff)
downloadst-scripts-03ea7ab107425851aca14b3d187a5813cdf16709.tar.gz
st-scripts-03ea7ab107425851aca14b3d187a5813cdf16709.tar.bz2
st-scripts-03ea7ab107425851aca14b3d187a5813cdf16709.zip
Merged heads.
-rw-r--r--functions.org13
1 files changed, 9 insertions, 4 deletions
diff --git a/functions.org b/functions.org
index 5675cc3..bb49268 100644
--- a/functions.org
+++ b/functions.org
@@ -22,17 +22,19 @@
equations. We shall first review these basics. Then we shall move on to
other details such as doc-strings, default arguments and keyword
arguments.
+
+ First let's start IPython by typing ipython in the terminal.
- Let's write a simple function that prints a Hello message, after
+ Let's write a simple function that prints a Hello message, upon
accepting a name.
def welcome(name):
print "Hello", name
- You would recall that def is a keyword that indicates a function
+ You would recall that def is a keyword that indicates the function
definition. 'welcome' is the name of the function and 'name' is
the lone argument to the function. Note that the function is
- defined within an indented block, similar to any other block. Our
+ defined within an indented block, just like to any other block. Our
function welcome just has one line in it's definition.
We can call our function, as follows -
@@ -55,7 +57,10 @@
Notice that the doc string uses triple quotes. If the doc-string
exceeds one line, we can use new line characters in it.
Also, as expected the doc-string is indented as is required
- for anything within a block.
+ for anything within a block. Now that we have written the
+ documentation, how do we access it? IPython provides the question
+ mark feature that we have seen in the previous tutorials. welcome?
+ will display the docstring that we have just written.
We shall now look at default arguments.
[show slide with examples of functions with default arguments]