Merged my head with mainline.
authorPuneeth Chaganti <punchagan@fossee.in>
Thu, 08 Oct 2009 19:05:34 +0530
changeset 68 0471f8694075
parent 67 4f2b4c14fc03 (current diff)
parent 60 edfe20d6733c (diff)
child 69 9fbd2a71fef2
Merged my head with mainline.
--- a/day1/Session-4.tex	Thu Oct 08 19:05:14 2009 +0530
+++ b/day1/Session-4.tex	Thu Oct 08 19:05:34 2009 +0530
@@ -137,11 +137,11 @@
   \inctime{5}
 \end{frame}
 
-\begin{frame} {Problem Set 2.1}
+\begin{frame} {Problem Set 6.1}
   \begin{description}
-\item[2.1.1] You are given date strings of the form ``29, Jul 2009'', or ``4 January 2008''. In other words a number a string and another number, with a comma sometimes separating the items.Write a function that takes such a string and returns a tuple (yyyy, mm, dd) where all three elements are ints.
-    \item[2.1.2] Count word frequencies in a file.
-    \item[2.1.3] Find the most used Python keywords in your Python code (import keyword).
+\item[6.1.1] You are given date strings of the form ``29, Jul 2009'', or ``4 January 2008''. In other words a number a string and another number, with a comma sometimes separating the items.Write a function that takes such a string and returns a tuple (yyyy, mm, dd) where all three elements are ints.
+    \item[6.1.2] Count word frequencies in a file.
+    \item[6.1.3] Find the most used Python keywords in your Python code (import keyword).
 \end{description}
 
 \inctime{10}
@@ -189,7 +189,7 @@
 
 
 \begin{frame}
-  \frametitle{Problem set 2.2}
+  \frametitle{Problem set 6.2}
   \begin{description}
     \item[2.2.1] Given a dictionary of the names of students and their marks, identify how many duplicate marks are there? and what are these?
     \item[2.2.2] Given a string of the form ``4-7, 9, 12, 15'' find the numbers missing in this list for a given range.
@@ -243,8 +243,8 @@
         print complaint
 
 ask_ok(prompt='?')
-ask_ok(prompt='?', complaint='[Y/N]')
-ask_ok(complaint='[Y/N]', prompt='?')
+ask_ok(prompt='?', complaint='[y/n]')
+ask_ok(complaint='[y/n]', prompt='?')
 \end{lstlisting}
 \inctime{15} 
 \end{frame}
@@ -299,6 +299,9 @@
  \frametitle{Errors}
  \begin{lstlisting}
 >>> while True print 'Hello world'
+ \end{lstlisting}
+\pause
+  \begin{lstlisting}
   File "<stdin>", line 1, in ?
     while True print 'Hello world'
                    ^
@@ -310,11 +313,22 @@
  \frametitle{Exceptions}
  \begin{lstlisting}
 >>> print spam
+\end{lstlisting}
+\pause
+\begin{lstlisting}
 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
 NameError: name 'spam' is not defined
+\end{lstlisting}
+\end{frame}
 
+\begin{frame}[fragile]
+ \frametitle{Exceptions}
+ \begin{lstlisting}
 >>> 1 / 0
+\end{lstlisting}
+\pause
+\begin{lstlisting}
 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
 ZeroDivisionError: integer division 
@@ -324,56 +338,19 @@
 
 \begin{frame}[fragile]
     \frametitle{Debugging effectively}
-
     \begin{itemize}
         \item  \kwrd{print} based strategy
         \item Process: Hypothesis, test, refine, rinse-repeat
-        \item Using \typ{\%debug} and \typ{\%pdb} in IPython
     \end{itemize}
+\inctime{15}
 \end{frame}
 
 \begin{frame}[fragile]
-\frametitle{Debugging: example}
-\small
-\begin{lstlisting}
->>> import pdb
->>> import mymodule
->>> pdb.run('mymodule.test()')
-> <string>(1)<module>()
-(Pdb) continue
-Traceback (most recent call last):
-  File "<stdin>", line 1, in <module>
-  File "/usr/lib/python2.6/pdb.py", line 1207, in run
-    Pdb().run(statement, globals, locals)
-  File "/usr/lib/python2.6/bdb.py", line 368, in run
-    exec cmd in globals, locals
-  File "<string>", line 1, in <module>
-  File "mymodule.py", line 2, in test
-    print spam
-NameError: global name 'spam' is not defined
-\end{lstlisting}
-\end{frame}
-
-\begin{frame}[fragile]
-\frametitle{Debugging in IPython}
-\small
-\begin{lstlisting}
-In [1]: %pdb
-Automatic pdb calling has been turned ON
-In [2]: import mymodule
-In [3]: mymodule.test()
-----------------------------------------------
-NameError    Traceback (most recent call last)
-/media/python/iitb/workshops/day1/<ipython console> in <module>()
-/media/python/iitb/workshops/day1/mymodule.pyc in test()
-      1 def test():
-----> 2     print spam
-NameError: global name 'spam' is not defined
-> /media/python/iitb/workshops/day1/mymodule.py(2)test()
-      0     print spam
-ipdb>
-\end{lstlisting}
-\inctime{15} 
+    \frametitle{Debugging effectively}
+    \begin{itemize}
+      \item Using \typ{\%debug} and \typ{\%pdb} in IPython
+    \end{itemize}
+\inctime{15}
 \end{frame}
 
 \begin{frame}[fragile]