Skip to content

Commit 73d08ec

Browse files
committed
Links added. TOC
1 parent 08f982a commit 73d08ec

9 files changed

Lines changed: 202 additions & 81 deletions

File tree

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1-
# Overview
1+
# 3. Program Organization
22

3-
In this section you will learn:
3+
So far, we've learned some Python basics and have written some short scripts.
4+
However, as you start to write larger programs, you'll want to get organized.
5+
This section dives into greater details on writing functions, handling errors,
6+
and introduces modules. By the end you should be able to write programs
7+
that are subdivided into functions across multiple files. We'll also give
8+
some useful code templates for writing more useful scripts.
49

5-
* How to organize larger programs.
6-
* Defining and working with functions.
7-
* Exceptions and Error handling.
8-
* Basic module management.
9-
* Script writing.
10+
* [3.1 Functions and Script Writing](01_Script)
11+
* [3.2 More Detail on Functions](02_More_functions)
12+
* [3.3 Exception Handling](03_Error_checking)
13+
* [3.4 Modules](04_Modules)
14+
* [3.5 Main module](05_Main_module)
15+
* [3.6 Design Discussion about Embracing Flexibilty](06_Design_discussion)
1016

11-
Python is great for short scripts, one-off problems, prototyping, testing, etc.
17+
[Contents](../Contents)
Lines changed: 16 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,16 @@
1-
# Overview
2-
3-
## Object Oriented (OO) programming
4-
5-
A Programming technique where code is organized as a collection of *objects*.
6-
7-
An *object* consists of:
8-
9-
* Data. Attributes
10-
* Behavior. Methods, functions applied to the object.
11-
12-
You have already been using some OO during this course.
13-
14-
For example with Lists.
15-
16-
```python
17-
>>> nums = [1, 2, 3]
18-
>>> nums.append(4) # Method
19-
>>> nums.insert(1,10) # Method
20-
>>> nums
21-
[1, 10, 2, 3, 4] # Data
22-
>>>
23-
```
24-
25-
`nums` is an *instance* of a list.
26-
27-
Methods (`append` and `insert`) are attached to the instance (`nums`).
28-
29-
## Summary
30-
31-
This will be a high-level overview of classes.
32-
33-
Most code involving classes will involve the topics covered in this section.
34-
35-
If you're merely using existing libraries, the code is typically fairly simple.
1+
# 4. Classes and Objects
2+
3+
So far, our programs have only used built-in Python datatypes. In
4+
this section, we introduce the concept of classes and objects. You'll
5+
learn about the `class` statement that allows you to make new objects.
6+
We'll also introduce the concept of inheritance, a tool that is commonly
7+
use to build extensible programs. Finally, we'll look at a few other
8+
features of classes including special methods, dynamic attribute lookup,
9+
and defining new exceptions.
10+
11+
* [4.1 Introducing Classes](01_Class)
12+
* [4.2 Inheritance](02_Inheritance)
13+
* [4.3 Special Methods](03_Special_methods)
14+
* [4.4 Defining new Exception](04_Defining_exceptions)
15+
16+
[Contents](../Contents)

Notes/04_Classes_objects/01_Class.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
# 4.1 Classes
22

3+
### Object Oriented (OO) programming
4+
5+
A Programming technique where code is organized as a collection of *objects*.
6+
7+
An *object* consists of:
8+
9+
* Data. Attributes
10+
* Behavior. Methods, functions applied to the object.
11+
12+
You have already been using some OO during this course.
13+
14+
For example with Lists.
15+
16+
```python
17+
>>> nums = [1, 2, 3]
18+
>>> nums.append(4) # Method
19+
>>> nums.insert(1,10) # Method
20+
>>> nums
21+
[1, 10, 2, 3, 4] # Data
22+
>>>
23+
```
24+
25+
`nums` is an *instance* of a list.
26+
27+
Methods (`append` and `insert`) are attached to the instance (`nums`).
28+
329
### The `class` statement
430

531
Use the `class` statement to define a new object.
Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
1-
# Overview
1+
# 5. Inner Workings of Python Objects
22

3-
The inner workings of Python Objects.
3+
This section covers some of the inner workings of Python objects.
4+
Programmers coming from other programming languages often find
5+
Python's notion of classes lacking in features. For example, there is
6+
no notion of access-control (e.g., private, protected), the whole
7+
`self` argument feels weird, and frankly, working with objects
8+
sometimes feel like a "free for all." Maybe that's true, but we'll
9+
find out how it all works as well as some common programming idioms to
10+
better encapsulate the internals of objects.
411

5-
In this section we will cover:
12+
It's not necessary to worry about the inner details to be productive.
13+
However, most Python coders have a basic awareness of how classes
14+
work. So, that's why we're covering it.
615

7-
* A few more details about how objects work.
8-
* How objects are represented.
9-
* Details of attribute access.
10-
* Data encapsulation techniques.
16+
* [5.1 Dictionaries Revisited (Object Implementation)](01_Dicts_revisited)
17+
* [5.2 Encapsulation Techniques](02_Classes_encapsulation)
18+
19+
[Contents](../Contents)
1120

Notes/06_Generators/00_Overview.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
# Overview
1+
# 6. Generators
22

3-
A simple definition of *Iteration*: Looping over items.
3+
Iteration (the `for`-loop) is one of the most common programming
4+
patterns in Python. Programs do a lot of iteration to process lists,
5+
read files, query databases, and more. One of the most powerful
6+
features of Python is the ability to customize and redefine iteration
7+
in the form of a so-called "generator function." This section
8+
introduces this topic. By the end, you'll write some programs that
9+
process some real-time streaming data in an interesting way.
410

5-
```python
6-
a = [2,4,10,37,62]
7-
# Iterate over a
8-
for x in a:
9-
...
10-
```
11+
* [6.1 Iteration Protocol](01_Iteration_protocol)
12+
* [6.2 Customizing Iteration with Generators](02_Customizing_iteration)
13+
* [6.3 Producer/Consumer Problems and Workflows](03_Producers_consumers)
14+
* [6.4 Generator Expressions](04_More_generators)
1115

12-
This is a very common pattern. Loops, list comprehensions, etc.
13-
14-
Most programs do a huge amount of iteration.
16+
[Contents](../Contents)
Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1-
# Overview
1+
# 7. Advanced Topics
22

3-
In this section we will take a look at more Python features you may encounter.
3+
In this section, we look at a small set of somewhat more advanced
4+
Python features that you might encounter in your day-to-day coding.
5+
Many of these topics could have been covered in earlier course
6+
sections, but weren't in order to spare you further head-explosion at
7+
the time.
48

5-
* Variable argument functions
6-
* Anonymous functions and lambda
7-
* Returning function and closures
8-
* Function decorators
9-
* Static and class methods
9+
It should be emphasized that the topics in this section are only meant
10+
to serve as a very basic introduction to these ideas. You will need
11+
to seek more advanced material to fill out details.
12+
13+
* [7.1 Variable argument functions](01_Variable_arguments)
14+
* [7.2 Anonymous functions and lambda](02_Anonymous_function)
15+
* [7.3 Returning function and closures](03_Retuning_functions)
16+
* [7.4 Function decorators](04_Function_decorators)
17+
* [7.5 Static and class methods](05_Decorated_methods)
18+
19+
[Contents](../Contents)

Notes/08_Testing_debugging/00_Overview.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
# Overview
1+
# 8. Overview
22

3-
In this section we will cover the basics of:
3+
This section introduces a few basic topics related to testing,
4+
logging, and debugging.
45

5-
* Testing
6-
* Logging, error handling and diagnostics
7-
* Debugging
6+
* [8.1 Testing](01_Testing)
7+
* [8.2 Logging, error handling and diagnostics](02_Logging)
8+
* [8.3 Debugging](03_Debugging)
9+
10+
[Contents](../Contents)
811

9-
Using Python.

Notes/09_Packages/00_Overview.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
1-
# Overview
1+
# 9 Packages
22

3-
In this section we will cover more details on:
3+
We conclude the course with a few details on how to organize your code
4+
into a package structure. We'll also discuss the installation of
5+
third party packages and preparing to give your own code away to others.
46

5-
* Packages.
6-
* Third Party Modules.
7-
* How to structure an application.
7+
The subject of packaging is an ever-evolving, overly complex part of
8+
Python development. Rather than focus on specific tools, the main
9+
focus of this section is on some general code organization principles
10+
that will prove useful no matter what tools you later use to give code
11+
away or manage dependencies.
12+
13+
* [9.1 Packages](01_Packages)
14+
* [9.2 Third Party Modules](02_Third_party)
15+
* [9.3 Giving your code to others](03_Distribution)
16+
17+
[Contents](../Contents)

Notes/Contents.md

Lines changed: 77 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,78 @@
1-
# Table of Contents
1+
# Practical Python Programming
2+
3+
## [1. Introduction to Python](01_Introduction/00_Overview)
4+
5+
* [1.1 Introducing Python](01_Introduction/01_Python)
6+
* [1.2 A First Program](01_Introduction/02_Hello_world)
7+
* [1.3 Numbers](01_Introduction/03_Numbers)
8+
* [1.4 Strings](01_Introduction/04_Strings)
9+
* [1.5 Lists](01_Introduction/05_Lists)
10+
* [1.6 Files](01_Introduction/06_Files)
11+
* [1.7 Functions](01_Introduction/07_Functions)
12+
13+
## [2. Working with Data](02_Working_with_data/00_Overview)
14+
15+
* [2.1 Datatypes and Data Structures](02_Working_with_data/01_Datatypes)
16+
* [2.2 Containers](02_Working_with_data/02_Containers)
17+
* [2.3 Formatted Output](02_Working_with_data/03_Formatting)
18+
* [2.4 Sequences](02_Working_with_data/04_Sequences)
19+
* [2.5 Collections module](02_Working_with_data/05_Collections)
20+
* [2.6 List comprehensions](02_Working_with_data/06_List_comprehension)
21+
* [2.7 Object model](02_Working_with_data/07_Objects)
22+
23+
## [3. Program Organization)(03_Program_organization/00_Overview)
24+
25+
* [3.1 Functions and Script Writing](03_Program_organization/01_Script)
26+
* [3.2 More Detail on Functions](03_Program_organization/02_More_functions)
27+
* [3.3 Exception Handling](03_Program_organization/03_Error_checking)
28+
* [3.4 Modules](03_Program_organization/04_Modules)
29+
* [3.5 Main module](03_Program_organization/05_Main_module)
30+
* [3.6 Design Discussion about Embracing Flexibilty](03_Program_organization/06_Design_discussion)
31+
32+
## [4. Classes and Objects)(04_Classes_objects/00_Overview)
33+
34+
* [4.1 Introducing Classes](04_Classes_objects/01_Class)
35+
* [4.2 Inheritance](04_Classes_objects/02_Inheritance)
36+
* [4.3 Special Methods](04_Classes_objects/03_Special_methods)
37+
* [4.4 Defining new Exception](04_Classes_objects/04_Defining_exceptions)
38+
39+
## [5. The Inner Workings of Python Objects)(05_Object_model/00_Overview)
40+
41+
* [5.1 Dictionaries Revisited (Object Implementation)](05_Object_model/01_Dicts_revisited)
42+
* [5.2 Encapsulation Techniques](05_Object_model/02_Classes_encapsulation)
43+
44+
## [6. Generators](06_Generators/00_Overview)
45+
46+
* [6.1 Iteration Protocol](06_Generators/01_Iteration_protocol)
47+
* [6.2 Customizing Iteration with Generators](06_Generators/02_Customizing_iteration)
48+
* [6.3 Producer/Consumer Problems and Workflows](06_Generators/03_Producers_consumers)
49+
* [6.4 Generator Expressions](06_Generators/04_More_generators)
50+
51+
## [7. A Few Advanced Topics](07_Advanced_Topics/00_Overview)
52+
53+
* [7.1 Variable argument functions](07_Advanced_Topics/01_Variable_arguments)
54+
* [7.2 Anonymous functions and lambda](07_Advanced_Topics/02_Anonymous_function)
55+
* [7.3 Returning function and closures](07_Advanced_Topics/03_Retuning_functions)
56+
* [7.4 Function decorators](07_Advanced_Topics/04_Function_decorators)
57+
* [7.5 Static and class methods](07_Advanced_Topics/05_Decorated_methods)
58+
59+
## [8. Testing, Logging, and Debugging](08_Testing_debugging/00_Overview)
60+
61+
* [8.1 Testing](08_Testing_debugging/01_Testing)
62+
* [8.2 Logging, error handling and diagnostics](08_Testing_debugging/02_Logging)
63+
* [8.3 Debugging](08_Testing_debugging/03_Debugging)
64+
65+
## [9. Packages](09_Packages/00_Overview)
66+
67+
* [9.1 Packages](09_Packages/01_Packages)
68+
* [9.2 Third Party Modules](09_Packages/02_Third_party)
69+
* [9.3 Giving your code to others](09_Packages/03_Distribution)
70+
71+
72+
73+
74+
75+
76+
77+
278

3-
This is contents

0 commit comments

Comments
 (0)