day1/Session-4.tex
changeset 63 f5eac04a00fe
parent 59 9aac0f128482
child 65 a525e580bc43
equal deleted inserted replaced
60:edfe20d6733c 63:f5eac04a00fe
    36     basicstyle=\ttfamily\bfseries,
    36     basicstyle=\ttfamily\bfseries,
    37     commentstyle=\color{red}\itshape,
    37     commentstyle=\color{red}\itshape,
    38   stringstyle=\color{darkgreen},
    38   stringstyle=\color{darkgreen},
    39   showstringspaces=false,
    39   showstringspaces=false,
    40   keywordstyle=\color{blue}\bfseries}
    40   keywordstyle=\color{blue}\bfseries}
       
    41 
       
    42 \usepackage{pgf}
    41 
    43 
    42 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    44 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    43 % Macros
    45 % Macros
    44 \setbeamercolor{emphbar}{bg=blue!20, fg=black}
    46 \setbeamercolor{emphbar}{bg=blue!20, fg=black}
    45 \newcommand{\emphbar}[1]
    47 \newcommand{\emphbar}[1]
   337 \end{frame}
   339 \end{frame}
   338 
   340 
   339 \begin{frame}[fragile]
   341 \begin{frame}[fragile]
   340     \frametitle{Debugging effectively}
   342     \frametitle{Debugging effectively}
   341     \begin{itemize}
   343     \begin{itemize}
   342         \item  \kwrd{print} based strategy
   344         \item \kwrd{print} based strategy
   343         \item Process: Hypothesis, test, refine, rinse-repeat
   345         \item Process:
   344     \end{itemize}
   346     \end{itemize}
   345 \inctime{15}
   347 \pgfimage[interpolate=true,width=5cm,height=5cm]{DebugginDiagram.png}
   346 \end{frame}
   348 \end{frame}
   347 
   349 
   348 \begin{frame}[fragile]
   350 \begin{frame}[fragile]
   349     \frametitle{Debugging effectively}
   351     \frametitle{Debugging effectively}
   350     \begin{itemize}
   352     \begin{itemize}
   351       \item Using \typ{\%debug} and \typ{\%pdb} in IPython
   353       \item Using \typ{\%debug} and \typ{\%pdb} in IPython
   352     \end{itemize}
   354     \end{itemize}
   353 \inctime{15}
   355 \end{frame}
       
   356 
       
   357 \begin{frame}[fragile]
       
   358 \frametitle{Debugging in IPython}
       
   359 \small
       
   360 \begin{lstlisting}
       
   361 In [1]: import mymodule
       
   362 In [2]: mymodule.test()
       
   363 ---------------------------------------------
       
   364 NameError   Traceback (most recent call last)
       
   365 /media/python/iitb/workshops/day1/<ipython console> in <module>()
       
   366 /media/python/iitb/workshops/day1/mymodule.py in test()
       
   367       1 def test():
       
   368 ----> 2     print spam
       
   369 NameError: global name 'spam' is not defined
       
   370 In [3]: %debug
       
   371 > /media/python/iitb/workshops/day1/mymodule.py(2)test()
       
   372       0     print spam
       
   373 ipdb> 
       
   374 \end{lstlisting}
       
   375 \inctime{15} 
   354 \end{frame}
   376 \end{frame}
   355 
   377 
   356 \begin{frame}[fragile]
   378 \begin{frame}[fragile]
   357 \frametitle{Debugging: Exercise}
   379 \frametitle{Debugging: Exercise}
   358 \inctime{10}
   380 \inctime{10}
   364     \item Creating and using Dictionaries
   386     \item Creating and using Dictionaries
   365     \item Creating and using Sets
   387     \item Creating and using Sets
   366     \item Advances Functions: default arguments, keyword arguments
   388     \item Advances Functions: default arguments, keyword arguments
   367     \item Functional Programming, list comprehensions
   389     \item Functional Programming, list comprehensions
   368     \item Errors and Exceptions in Python
   390     \item Errors and Exceptions in Python
   369     \item Debugging: How to use pdb, \%pdb and \%debug in IPython
   391     \item Debugging: \%pdb and \%debug in IPython
   370   \end{itemize}
   392   \end{itemize}
   371 \end{frame}
   393 \end{frame}
   372 \end{document}
   394 \end{document}