Skip to content

Commit 4c8bd8c

Browse files
committed
very early start of presentation
1 parent 45951ee commit 4c8bd8c

4 files changed

Lines changed: 84 additions & 14 deletions

File tree

week-06/presentation-week06.pdf

6 Bytes
Binary file not shown.

week-06/presentation-week06.tex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,16 +288,16 @@ \section{Python Classes}
288288
{\Large About the simplest class:}
289289
290290
\begin{verbatim}
291-
>>> class Point:
291+
>>> class Point(object):
292292
... x = 1
293293
... y = 2
294294
>>> Point
295295
<class __main__.Point at 0x2bf928>
296-
>>> p
297-
<__main__.Point instance at 0x2de918>
298296
>>> Point.x
299297
1
300298
>>> p = Point()
299+
>>> p
300+
<__main__.Point instance at 0x2de918>
301301
>>> p.x
302302
1
303303
\end{verbatim}

week-07/presentation-week07.pdf

78.4 KB
Binary file not shown.

week-07/presentation-week07.tex

Lines changed: 81 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
\documentclass{beamer}
22
%\usepackage[latin1]{inputenc}
33
\usetheme{Warsaw}
4-
\title[Intro to Python: Week 7]{Introduction to Python}
4+
\title[Intro to Python: Week 7]{Introduction to Python\\ More OO -- Decorators and Generators}
55
\author{Christopher Barker}
66
\institute{UW Continuing Education / Isilon}
77
\date{August 08, 2012}
@@ -27,10 +27,17 @@
2727
\section{Review/Questions}
2828

2929
% ---------------------------------------------
30-
\begin{frame}{Review of Previous Class}
30+
\begin{frame}[fragile]{Review of Previous Class}
3131

3232
\begin{itemize}
33-
\item ...
33+
\item Really Quick OO overview
34+
\item Built an html generator, using:
35+
\begin{itemize}
36+
\item A base class with a couple methods
37+
\item Subclasses overriding class attributes
38+
\item Subclasses overriding a method
39+
\item Subclasses overriding the \verb|__init__|
40+
\end{itemize}
3441
\end{itemize}
3542

3643
\end{frame}
@@ -44,32 +51,95 @@ \section{Review/Questions}
4451

4552
\end{frame}
4653

47-
\section{First Section}
54+
\section{More OO}
4855

4956
% ---------------------------------------------
50-
\begin{frame}[fragile]{First Topic}
57+
\begin{frame}[fragile]{multiple inheritance}
5158

52-
{\Large A topicc}
59+
{\Large Multiple inheritance:\\
60+
\hspace{0.2in} Pulling from more than one class}
5361

62+
\vfill
5463
\begin{verbatim}
55-
some code example
64+
class Combined(Super1, Super2, Super3):
65+
def __init__(self, something, something else):
66+
Super1.__init__(self, ......)
67+
Super2.__init__(self, ......)
68+
Super3.__init__(self, ......)
5669
\end{verbatim}
70+
(calls to the super class \verb|__init__| are optional -- case dependent)
71+
72+
\vfill
73+
{\Large Attribute resolution -- left to right}
74+
75+
\vfill
76+
( Why would you want to do this? )
5777

5878
\end{frame}
5979

60-
\section{Another Section}
80+
% ---------------------------------------------
81+
\begin{frame}[fragile]{mix-ins}
82+
83+
\vfill
84+
{\Large Hierarchies are not always simple}
85+
\vfill
86+
\begin{itemize}
87+
\item Animal
88+
\begin{itemize}
89+
\item Mammal
90+
\begin{itemize}
91+
\item GiveBirth()
92+
\end{itemize}
93+
\item Bird
94+
\begin{itemize}
95+
\item LayEggs()
96+
\end{itemize}
97+
\end{itemize}
98+
\end{itemize}
99+
\vfill
100+
{\Large Where do you put a Platypus or an Armadillo?}
101+
102+
\vfill
103+
{\Large Real World Example: \verb|FloatCanvas|}
104+
\end{frame}
61105

62106
% ---------------------------------------------
63-
\begin{frame}[fragile]{First Topic}
107+
\begin{frame}[fragile]{properties}
64108

65-
{\Large A topicc}
109+
{\Large Simple attributes:}
66110

67111
\begin{verbatim}
68-
some code example
112+
In [5]: class C(object):
113+
def __init__(self):
114+
self.x = 5
115+
In [6]: c = C()
116+
In [7]: c.x
117+
Out[7]: 5
118+
In [8]: c.x = 8
119+
In [9]: c.x
120+
Out[9]: 8
69121
\end{verbatim}
70122

71123
\end{frame}
72124

125+
126+
127+
\section{Special Methods}
128+
129+
130+
%\section{Another Section}
131+
%
132+
%% ---------------------------------------------
133+
%\begin{frame}[fragile]{First Topic}
134+
%
135+
% {\Large A topicc}
136+
%
137+
%\begin{verbatim}
138+
%some code example
139+
%\end{verbatim}
140+
%
141+
%\end{frame}
142+
73143
\end{document}
74144

75145

0 commit comments

Comments
 (0)