day2/session4.tex
branchscipy2010
changeset 433 af45c8da1d5d
parent 432 13e5d0e2cd40
child 434 99e1af343b04
equal deleted inserted replaced
432:13e5d0e2cd40 433:af45c8da1d5d
   250 \begin{frame}{Readability and Consistency}
   250 \begin{frame}{Readability and Consistency}
   251     \begin{itemize}
   251     \begin{itemize}
   252         \item Readability Counts!\\Code is read more often than its written.
   252         \item Readability Counts!\\Code is read more often than its written.
   253         \item Consistency!
   253         \item Consistency!
   254         \item Know when to be inconsistent.
   254         \item Know when to be inconsistent.
       
   255         \item Play telephone with that line of code.
   255       \end{itemize}
   256       \end{itemize}
   256 \end{frame}
   257 \end{frame}
   257 
   258 
   258 \begin{frame}[fragile] \frametitle{A question of good style}
   259 \begin{frame}[fragile] \frametitle{A question of good style}
   259   \begin{lstlisting}
   260   \begin{lstlisting}
   260     amount = 12.68
   261     amount = 12.68
   261     denom = 0.05
   262     denom = 0.05
   262     nCoins = round(amount/denom)
   263     num_coins = round(amount/denom)
   263     rAmount = nCoins * denom
   264     rounded_amount = num_coins * denom
   264   \end{lstlisting}
   265   \end{lstlisting}
   265   \pause
   266   \pause
   266   \begin{block}{Style Rule \#1}
   267   \begin{block}{Style Rule \#1}
   267     Naming is 80\% of programming
   268     Naming is 80\% of programming
   268   \end{block}
   269   \end{block}
   274         \item Indentation
   275         \item Indentation
   275         \item Tabs or Spaces?
   276         \item Tabs or Spaces?
   276         \item Maximum Line Length
   277         \item Maximum Line Length
   277         \item Blank Lines
   278         \item Blank Lines
   278         \item Encodings
   279         \item Encodings
       
   280         \item Consider any legible book
   279    \end{itemize}
   281    \end{itemize}
   280 \end{frame}
   282 \end{frame}
   281 
   283 
   282 \begin{frame}{Whitespaces in Expressions}
   284 \begin{frame}{Whitespaces in Expressions}
   283   \begin{itemize}
   285   \begin{itemize}
   299   \begin{itemize}
   301   \begin{itemize}
   300         \item When to write docstrings?
   302         \item When to write docstrings?
   301         \item Ending the docstrings
   303         \item Ending the docstrings
   302         \item One liner docstrings
   304         \item One liner docstrings
   303    \end{itemize}
   305    \end{itemize}
   304 More information at PEP8: http://www.python.org/dev/peps/pep-0008/
   306 \end{frame}
   305 \inctime{5}
   307 
       
   308 \begin{frame}{The Python Style Guide}
       
   309   \begin{itemize}
       
   310    \item PEP8
       
   311    \item PEP8
       
   312    \item PEP8
       
   313    \item \url{http://www.python.org/dev/peps/pep-0008/}
       
   314    \end{itemize}
   306 \end{frame}
   315 \end{frame}
   307 
   316 
   308 \section{Debugging}
   317 \section{Debugging}
   309 \subsection{Errors and Exceptions}
   318 \subsection{Errors and Exceptions}
   310 \begin{frame}[fragile]
   319 \begin{frame}[fragile]