Skip to content

Commit e1c29f2

Browse files
committed
clenaed up session 8 presentation
1 parent 9eb6cbb commit e1c29f2

File tree

5 files changed

+171
-76
lines changed

5 files changed

+171
-76
lines changed

build_gh_pages.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,20 @@
33
# simple script to build and push to gh-pages
44
# designed to be run from master
55

6+
# make sure this repo is updated in gitHub:
7+
git commit -a
8+
9+
git push
10+
611
# make the docs
712
make html
813

914
# copy to other repo (on the gh-pages branch)
1015
cp -R build/html/ ../gh-pages-version/
1116

17+
# go to other clone and push the html
1218
cd ../gh-pages-version
1319
git add * # in case there are new files added
1420
git commit -a
1521
git push
22+

code/session05/lambda_keyword_solution.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,38 @@
11
#!/usr/bin/env python
22

33
"""
4-
example code for using lambda, keywords, and keyword scope
4+
Example code for using lambda, keywords, and keyword scope
55
66
77
The challenge:
88
99
Write a function that returns a list of n functions,
1010
such that each one, when called, will return the input value,
11-
incremented by an increaseing number.
11+
incremented by an increasing number.
1212
13-
you should use a for loop, lambda, and a keyword argument
13+
You should use a for loop, lambda, and a keyword argument
1414
15-
extra credit: do it with a list comprhension, instead of a for loop
15+
extra credit: do it with a list comprehension, instead of a for loop
1616
1717
"""
1818

19+
1920
def function_builder(n):
2021

2122
l = []
2223
for i in range(n):
2324
l.append( lambda x, i=i: x+i )
2425
return l
2526

27+
2628
def function_builder2(n):
2729

2830
return [ lambda x, i=i: x+i for i in range(n) ]
2931

3032

3133
if __name__ == "__main__":
3234
## some simples tests
33-
35+
3436
# uncomment to test second version
3537
# function_builder = function_builder2
3638

source/session06.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ About the simplest class you can write
245245
Basic Structure of a real class:
246246

247247
.. code-block:: python
248-
248+
249249
class Point(object):
250250
# everything defined in here is in the class namespace
251251
@@ -261,7 +261,7 @@ Basic Structure of a real class:
261261
print "p.y is:", p.y
262262
263263
264-
see: ``code/simple_class``
264+
see: ``Examples/Session06/simple_class``
265265

266266
.. nextslide::
267267

@@ -271,7 +271,7 @@ The ``__init__`` special method is called when a new instance of a class is cre
271271

272272
You can use it to do any set-up you need
273273

274-
.. code-block:: python
274+
.. code-block:: python
275275
276276
class Point(object):
277277
def __init__(self, x, y):
@@ -393,15 +393,14 @@ Let's say you need to render some html..
393393

394394
The goal is to build a set of classes that render an html page.
395395

396-
``code/session06/sample_html.html``
396+
``Examples/Session06/sample_html.html``
397397

398398
We'll start with a single class, then add some sub-classes to specialize the behavior
399399

400400
Details in:
401401

402402
:ref:`homework_html_renderer`
403403

404-
|
405404

406405
Let's see if we can do step 1. in class...
407406

0 commit comments

Comments
 (0)