@@ -73,7 +73,7 @@ \section{Intro to the Class}
7373
7474\begin {frame }{Chris' History}
7575
76- {\Large Back to School: PhD Engineering }
76+ {\Large Back to School: PhD Coastal Engineering }
7777 \begin {itemize }
7878 \item DOS / Windows 3.1
7979 \begin {itemize }
@@ -98,7 +98,7 @@ \section{Intro to the Class}
9898 {\Large Gave TCL a try............ }
9999
100100 \pause
101- \vspace {0.25in }
101+ \vspace {0.15in }
102102 {\Large Gave Perl a try............}
103103
104104\end {frame }
@@ -118,9 +118,7 @@ \section{Intro to the Class}
118118
119119{\Large My Python use now:}
120120\begin {itemize }
121- \item Lots of text file crunching
122- \item Lots of data processing scripts
123- \item Automation of downloading, processing data
121+ \item Lots of text file crunching / data processing
124122 \item Desktop GUIs (wxPython)
125123 \item computational code
126124 \item wrapping C/C++ code
@@ -196,18 +194,6 @@ \section{Intro to the Class}
196194\end {frame }
197195
198196
199- \section {What is Python? }
200-
201- \begin {frame }{What is Python?}
202- \begin {itemize }
203- \item Dynamic
204- \item Object oriented
205- \item Byte-compiled
206- \item interpreted
207- \item ....
208- \end {itemize }
209- \end {frame }
210-
211197\begin {frame }{Python Ecosystem}
212198
213199{\Large Used for:}
@@ -253,6 +239,19 @@ \section{What is Python?}
253239\end {itemize }
254240\end {frame }
255241
242+ % \section{What is Python?}
243+
244+ % \begin{frame}{What is Python?}
245+ % \begin{itemize}
246+ % \item Dynamic
247+ % \item Object oriented
248+ % \item Byte-compiled
249+ % \item interpreted
250+ % \item ....
251+ % \end{itemize}
252+ % \end{frame}
253+
254+
256255\begin {frame }{Python Features}
257256
258257{\Large Features:}
@@ -270,6 +269,40 @@ \section{What is Python?}
270269
271270\end {frame }
272271
272+ \begin {frame }[fragile]{What's a Dynamic language}
273+
274+ Strong, Dynamic typing.
275+
276+ - Type checking and dispatch happen at run-time
277+
278+ \vspace {0.25in}
279+ {\Large \verb !X = A+B !}
280+ \vspace {0.1in}
281+ \begin {itemize }
282+ \pause
283+ \item What is A?
284+ \item What is B?
285+ \item What does is mean to add them?
286+ \vspace {0.2in}
287+ \pause
288+ \item A and B can change at any time before this process
289+ \end {itemize }
290+
291+ \end {frame }
292+
293+ \begin {frame }{Duck Typing}
294+
295+ \vspace {0.25in}
296+ {\center \Large `` If it looks like a duck, and quacks like a duck -- it's probably a duck'' }
297+
298+ \pause
299+ \vspace {0.5in}
300+ {\center \Large If an object behaves as expected at run-time, it's the right type.}
301+
302+ \end {frame }
303+
304+
305+
273306\begin {frame }{Python Versions}
274307
275308{\Large Python 2.*}
@@ -330,28 +363,6 @@ \section{What is Python?}
330363
331364\end {frame }
332365
333-
334- \begin {frame }[fragile]{What's a Dynamic language}
335-
336- Strong, Dynamic typing.
337-
338- - Type checking and dispatch happen at run-time
339-
340- \vspace {0.25in}
341- {\Large \verb !X = A+B !}
342- \vspace {0.1in}
343- \begin {itemize }
344- \pause
345- \item What is A?
346- \item What is B?
347- \item What does is mean to add them?
348- \vspace {0.2in}
349- \pause
350- \item A and B can change at any time before this process
351- \end {itemize }
352-
353- \end {frame }
354-
355366\begin {frame }[fragile]{Using Python}
356367
357368All you need for Python:
@@ -406,14 +417,14 @@ \section{What is Python?}
406417
407418 \item \verb +>>> import hello + -- at the python prompt -- importing a module executes its contents
408419
409- \item \verb +In [79]: run hello.py + -- at the IPython prompt -- running a module brings the names into the interactive namespace
420+ \item \verb +run hello.py + -- at the IPython prompt -- running a module brings the names into the interactive namespace
410421\end {enumerate }
411422
412423\end {frame }
413424
414425\begin {frame }[fragile]{Documentation}
415426
416- {\Large python.org docs:}
427+ {\Large \url {www. python.org} docs:}
417428
418429\url {http://docs.python.org/index.html}
419430
@@ -435,7 +446,7 @@ \section{What is Python?}
435446\begin {description }
436447 \item [PEP 1] PEP Purpose and Guidelines
437448 \item [PEP 8] Style Guide for Python Code
438- \item [PEP 20] the Zen of Python
449+ \item [PEP 20] the Zen of Python ( \verb + import this +)
439450\end {description }
440451
441452\end {frame }
@@ -485,19 +496,17 @@ \section{What is Python?}
485496
486497\begin {itemize }
487498 \item Log in
488- \item Do a git or SVN checkout of the project
499+ \item Do a \verb + git clone + or \verb + svn checkout+ of the project
489500 \item Start up the Python interpreter:\\
490501 \verb +$ python + ( \verb =ctrl+D = to exit )
491- \item Run \verb +hello.py +
502+ \item Run \verb +hello.py + (in the \verb + week-01/code + dir)
492503 \item Create a file in your editor and save it
493504 \item Start up \verb +IPython + \\
494505 \verb +$ ipython + ( also \verb =ctrl+D = to exit )
495506 \item Run \verb +hello.py + in \verb +IPython +
496507 \item use \verb +? + in \verb +IPython + on anything...
497-
498- if you have time:
499- \vspace {0.2in}
500- \url {http://learnpythonthehardway.org/book/ex1.html}
508+ \item if you have time:\\
509+ \url {http://learnpythonthehardway.org/book/ex1.html}\\
501510\url {http://learnpythonthehardway.org/book/ex2.html}
502511
503512
@@ -522,7 +531,7 @@ \section{Values, Expressions, and Types}
522531 \item Every value belongs to a type: integer, float, str, ... (demo)
523532
524533 \item An expression is made up of values and operators, is evaluated to
525- produce a value -- \verb + 2 + 2+ , etc.
534+ produce a value: \verb ! 2 + 2 ! , etc.
526535
527536 \item Python interpreter can be used as a calculator to evaluate expressions (demo)
528537
@@ -559,46 +568,60 @@ \section{Values, Expressions, and Types}
559568
560569\begin {frame }[fragile]{Assignment}
561570
562- {\large Assignment is really name binding: }
571+ {\Large Assignment is really name binding: }
572+ \begin {itemize }
573+ \item Attaching a name to a value
574+ \item A value can have many names (or none!)
575+ \end {itemize }
563576
564- Attaching a name to a value
577+ {\large
578+ \vspace {0.1in}
579+ \verb += + assigns (binds a name)
565580
566- A value can have many names (or none!)
581+ \vspace {0.1in}
582+ \verb +del + only unbinds a name
567583
568- \vspace {0.2in }
569- \verb + = + assigns
584+ \vspace {0.1in }
585+ { \Large Multiple Assignment}
570586
571- \vspace {0.2in}
572- \verb +== + checks equality
587+ \vspace {0.1in}
573588
574- \vspace {0.2in}
575- \verb +is + checks identity
589+ \verb +a, b = 1, 2 +
576590
577- \vspace {0.2in}
578- \verb +id() + queries identity
591+ \vspace {0.1in}
592+ This will come in handy later...
593+ }
579594
580- \vspace {0.2in }
595+ \vspace {0.1in }
581596(demo)
582597
583598\end {frame }
584599
585- \begin {frame }[fragile]{Assignment }
600+ \begin {frame }[fragile]{equality and identity }
586601
587- {\Large Multiple Assignment
602+ {\large
603+ \vspace {0.1in}
604+ \verb +== + checks equality
588605
589- \vspace {0.25in}
606+ \vspace {0.1in}
607+ \verb +is + checks identity
590608
591- \verb +a, b = 1, 2 +
609+ \vspace {0.1in}
610+ \verb +id() + queries identity
592611}
593612
613+ \vspace {0.2in}
614+ (demo)
615+
616+
594617\end {frame }
595618
596619
597620\begin {frame }[fragile]{Operator Precedence}
598621
599- Operators Precedence determines what evaluates first:
622+ Operator Precedence determines what evaluates first:
600623
601- \verb ^4+3* 5 != (4+3)* 5 ^ -- Use parentheses !
624+ \verb ^4 + 3 * 5 != (4 + 3) * 5 ^ -- Use parentheses !
602625
603626Precedence of common operators:
604627
@@ -701,6 +724,7 @@ \section{Functions}
701724\end {verbatim }
702725
703726\pause
727+ \vspace {0.25in}
704728{\Large Pass Statement (Note the indentation!)}
705729\begin {verbatim }
706730def <name>():
@@ -765,7 +789,7 @@ \section{Functions}
765789 return 5
766790\end {verbatim }
767791
768- {\Large Actual simplest function}
792+ {\Large Actually simplest function}
769793\begin {verbatim }
770794def fun():
771795 return None
@@ -985,7 +1009,7 @@ \section{Functions}
9851009\begin {itemize }
9861010 \item takes a number and returns the square and cube of that number
9871011 -- use local variables to store the results
988- \item takes a string and a number, and returns a new string with the value repeated the given number of times
1012+ \item takes a string and a number, and returns a new string containing the input string repeated the given number of times
9891013 \item uses both global and local variable to compute a result.
9901014 \item calls another function to do part of its job.
9911015 \item take some code with functions, add this to each function:
0 commit comments