diff --git a/Notes/03_Program_organization/00_Overview.md b/Notes/03_Program_organization/00_Overview.md index 446f1c9..11ed86c 100644 --- a/Notes/03_Program_organization/00_Overview.md +++ b/Notes/03_Program_organization/00_Overview.md @@ -1,11 +1,17 @@ -# Overview +# 3. Program Organization -In this section you will learn: +So far, we've learned some Python basics and have written some short scripts. +However, as you start to write larger programs, you'll want to get organized. +This section dives into greater details on writing functions, handling errors, +and introduces modules. By the end you should be able to write programs +that are subdivided into functions across multiple files. We'll also give +some useful code templates for writing more useful scripts. -* How to organize larger programs. -* Defining and working with functions. -* Exceptions and Error handling. -* Basic module management. -* Script writing. +* [3.1 Functions and Script Writing](01_Script) +* [3.2 More Detail on Functions](02_More_functions) +* [3.3 Exception Handling](03_Error_checking) +* [3.4 Modules](04_Modules) +* [3.5 Main module](05_Main_module) +* [3.6 Design Discussion about Embracing Flexibilty](06_Design_discussion) -Python is great for short scripts, one-off problems, prototyping, testing, etc. +[Contents](../Contents) diff --git a/Notes/04_Classes_objects/00_Overview.md b/Notes/04_Classes_objects/00_Overview.md index 5485eee..7c3eef9 100644 --- a/Notes/04_Classes_objects/00_Overview.md +++ b/Notes/04_Classes_objects/00_Overview.md @@ -1,35 +1,16 @@ -# Overview +# 4. Classes and Objects -## Object Oriented (OO) programming +So far, our programs have only used built-in Python datatypes. In +this section, we introduce the concept of classes and objects. You'll +learn about the `class` statement that allows you to make new objects. +We'll also introduce the concept of inheritance, a tool that is commonly +use to build extensible programs. Finally, we'll look at a few other +features of classes including special methods, dynamic attribute lookup, +and defining new exceptions. -A Programming technique where code is organized as a collection of *objects*. +* [4.1 Introducing Classes](01_Class) +* [4.2 Inheritance](02_Inheritance) +* [4.3 Special Methods](03_Special_methods) +* [4.4 Defining new Exception](04_Defining_exceptions) -An *object* consists of: - -* Data. Attributes -* Behavior. Methods, functions applied to the object. - -You have already been using some OO during this course. - -For example with Lists. - -```python ->>> nums = [1, 2, 3] ->>> nums.append(4) # Method ->>> nums.insert(1,10) # Method ->>> nums -[1, 10, 2, 3, 4] # Data ->>> -``` - -`nums` is an *instance* of a list. - -Methods (`append` and `insert`) are attached to the instance (`nums`). - -## Summary - -This will be a high-level overview of classes. - -Most code involving classes will involve the topics covered in this section. - -If you're merely using existing libraries, the code is typically fairly simple. +[Contents](../Contents) \ No newline at end of file diff --git a/Notes/04_Classes_objects/01_Class.md b/Notes/04_Classes_objects/01_Class.md index ee47617..e8b4a23 100644 --- a/Notes/04_Classes_objects/01_Class.md +++ b/Notes/04_Classes_objects/01_Class.md @@ -1,5 +1,31 @@ # 4.1 Classes +### Object Oriented (OO) programming + +A Programming technique where code is organized as a collection of *objects*. + +An *object* consists of: + +* Data. Attributes +* Behavior. Methods, functions applied to the object. + +You have already been using some OO during this course. + +For example with Lists. + +```python +>>> nums = [1, 2, 3] +>>> nums.append(4) # Method +>>> nums.insert(1,10) # Method +>>> nums +[1, 10, 2, 3, 4] # Data +>>> +``` + +`nums` is an *instance* of a list. + +Methods (`append` and `insert`) are attached to the instance (`nums`). + ### The `class` statement Use the `class` statement to define a new object. diff --git a/Notes/05_Object_model/00_Overview.md b/Notes/05_Object_model/00_Overview.md index d753bd9..17b693e 100644 --- a/Notes/05_Object_model/00_Overview.md +++ b/Notes/05_Object_model/00_Overview.md @@ -1,11 +1,20 @@ -# Overview +# 5. Inner Workings of Python Objects -The inner workings of Python Objects. +This section covers some of the inner workings of Python objects. +Programmers coming from other programming languages often find +Python's notion of classes lacking in features. For example, there is +no notion of access-control (e.g., private, protected), the whole +`self` argument feels weird, and frankly, working with objects +sometimes feel like a "free for all." Maybe that's true, but we'll +find out how it all works as well as some common programming idioms to +better encapsulate the internals of objects. -In this section we will cover: +It's not necessary to worry about the inner details to be productive. +However, most Python coders have a basic awareness of how classes +work. So, that's why we're covering it. -* A few more details about how objects work. -* How objects are represented. -* Details of attribute access. -* Data encapsulation techniques. +* [5.1 Dictionaries Revisited (Object Implementation)](01_Dicts_revisited) +* [5.2 Encapsulation Techniques](02_Classes_encapsulation) + +[Contents](../Contents) diff --git a/Notes/06_Generators/00_Overview.md b/Notes/06_Generators/00_Overview.md index aabac6f..6d3b81e 100644 --- a/Notes/06_Generators/00_Overview.md +++ b/Notes/06_Generators/00_Overview.md @@ -1,14 +1,16 @@ -# Overview +# 6. Generators -A simple definition of *Iteration*: Looping over items. +Iteration (the `for`-loop) is one of the most common programming +patterns in Python. Programs do a lot of iteration to process lists, +read files, query databases, and more. One of the most powerful +features of Python is the ability to customize and redefine iteration +in the form of a so-called "generator function." This section +introduces this topic. By the end, you'll write some programs that +process some real-time streaming data in an interesting way. -```python -a = [2,4,10,37,62] -# Iterate over a -for x in a: - ... -``` +* [6.1 Iteration Protocol](01_Iteration_protocol) +* [6.2 Customizing Iteration with Generators](02_Customizing_iteration) +* [6.3 Producer/Consumer Problems and Workflows](03_Producers_consumers) +* [6.4 Generator Expressions](04_More_generators) -This is a very common pattern. Loops, list comprehensions, etc. - -Most programs do a huge amount of iteration. +[Contents](../Contents) diff --git a/Notes/07_Advanced_Topics/00_Overview.md b/Notes/07_Advanced_Topics/00_Overview.md index a95040b..00644a0 100644 --- a/Notes/07_Advanced_Topics/00_Overview.md +++ b/Notes/07_Advanced_Topics/00_Overview.md @@ -1,9 +1,19 @@ -# Overview +# 7. Advanced Topics -In this section we will take a look at more Python features you may encounter. +In this section, we look at a small set of somewhat more advanced +Python features that you might encounter in your day-to-day coding. +Many of these topics could have been covered in earlier course +sections, but weren't in order to spare you further head-explosion at +the time. -* Variable argument functions -* Anonymous functions and lambda -* Returning function and closures -* Function decorators -* Static and class methods +It should be emphasized that the topics in this section are only meant +to serve as a very basic introduction to these ideas. You will need +to seek more advanced material to fill out details. + +* [7.1 Variable argument functions](01_Variable_arguments) +* [7.2 Anonymous functions and lambda](02_Anonymous_function) +* [7.3 Returning function and closures](03_Retuning_functions) +* [7.4 Function decorators](04_Function_decorators) +* [7.5 Static and class methods](05_Decorated_methods) + +[Contents](../Contents) diff --git a/Notes/08_Testing_debugging/00_Overview.md b/Notes/08_Testing_debugging/00_Overview.md index 5fce359..679e2d7 100644 --- a/Notes/08_Testing_debugging/00_Overview.md +++ b/Notes/08_Testing_debugging/00_Overview.md @@ -1,9 +1,11 @@ -# Overview +# 8. Overview -In this section we will cover the basics of: +This section introduces a few basic topics related to testing, +logging, and debugging. -* Testing -* Logging, error handling and diagnostics -* Debugging +* [8.1 Testing](01_Testing) +* [8.2 Logging, error handling and diagnostics](02_Logging) +* [8.3 Debugging](03_Debugging) + +[Contents](../Contents) -Using Python. diff --git a/Notes/09_Packages/00_Overview.md b/Notes/09_Packages/00_Overview.md index 4e46da7..06e5aae 100644 --- a/Notes/09_Packages/00_Overview.md +++ b/Notes/09_Packages/00_Overview.md @@ -1,7 +1,17 @@ -# Overview +# 9 Packages -In this section we will cover more details on: +We conclude the course with a few details on how to organize your code +into a package structure. We'll also discuss the installation of +third party packages and preparing to give your own code away to others. -* Packages. -* Third Party Modules. -* How to structure an application. +The subject of packaging is an ever-evolving, overly complex part of +Python development. Rather than focus on specific tools, the main +focus of this section is on some general code organization principles +that will prove useful no matter what tools you later use to give code +away or manage dependencies. + +* [9.1 Packages](01_Packages) +* [9.2 Third Party Modules](02_Third_party) +* [9.3 Giving your code to others](03_Distribution) + +[Contents](../Contents) diff --git a/Notes/Contents.md b/Notes/Contents.md index 9919aa5..c7854ab 100644 --- a/Notes/Contents.md +++ b/Notes/Contents.md @@ -1,3 +1,78 @@ -# Table of Contents +# Practical Python Programming + +## [1. Introduction to Python](01_Introduction/00_Overview) + +* [1.1 Introducing Python](01_Introduction/01_Python) +* [1.2 A First Program](01_Introduction/02_Hello_world) +* [1.3 Numbers](01_Introduction/03_Numbers) +* [1.4 Strings](01_Introduction/04_Strings) +* [1.5 Lists](01_Introduction/05_Lists) +* [1.6 Files](01_Introduction/06_Files) +* [1.7 Functions](01_Introduction/07_Functions) + +## [2. Working with Data](02_Working_with_data/00_Overview) + +* [2.1 Datatypes and Data Structures](02_Working_with_data/01_Datatypes) +* [2.2 Containers](02_Working_with_data/02_Containers) +* [2.3 Formatted Output](02_Working_with_data/03_Formatting) +* [2.4 Sequences](02_Working_with_data/04_Sequences) +* [2.5 Collections module](02_Working_with_data/05_Collections) +* [2.6 List comprehensions](02_Working_with_data/06_List_comprehension) +* [2.7 Object model](02_Working_with_data/07_Objects) + +## [3. Program Organization)(03_Program_organization/00_Overview) + +* [3.1 Functions and Script Writing](03_Program_organization/01_Script) +* [3.2 More Detail on Functions](03_Program_organization/02_More_functions) +* [3.3 Exception Handling](03_Program_organization/03_Error_checking) +* [3.4 Modules](03_Program_organization/04_Modules) +* [3.5 Main module](03_Program_organization/05_Main_module) +* [3.6 Design Discussion about Embracing Flexibilty](03_Program_organization/06_Design_discussion) + +## [4. Classes and Objects)(04_Classes_objects/00_Overview) + +* [4.1 Introducing Classes](04_Classes_objects/01_Class) +* [4.2 Inheritance](04_Classes_objects/02_Inheritance) +* [4.3 Special Methods](04_Classes_objects/03_Special_methods) +* [4.4 Defining new Exception](04_Classes_objects/04_Defining_exceptions) + +## [5. The Inner Workings of Python Objects)(05_Object_model/00_Overview) + +* [5.1 Dictionaries Revisited (Object Implementation)](05_Object_model/01_Dicts_revisited) +* [5.2 Encapsulation Techniques](05_Object_model/02_Classes_encapsulation) + +## [6. Generators](06_Generators/00_Overview) + +* [6.1 Iteration Protocol](06_Generators/01_Iteration_protocol) +* [6.2 Customizing Iteration with Generators](06_Generators/02_Customizing_iteration) +* [6.3 Producer/Consumer Problems and Workflows](06_Generators/03_Producers_consumers) +* [6.4 Generator Expressions](06_Generators/04_More_generators) + +## [7. A Few Advanced Topics](07_Advanced_Topics/00_Overview) + +* [7.1 Variable argument functions](07_Advanced_Topics/01_Variable_arguments) +* [7.2 Anonymous functions and lambda](07_Advanced_Topics/02_Anonymous_function) +* [7.3 Returning function and closures](07_Advanced_Topics/03_Retuning_functions) +* [7.4 Function decorators](07_Advanced_Topics/04_Function_decorators) +* [7.5 Static and class methods](07_Advanced_Topics/05_Decorated_methods) + +## [8. Testing, Logging, and Debugging](08_Testing_debugging/00_Overview) + +* [8.1 Testing](08_Testing_debugging/01_Testing) +* [8.2 Logging, error handling and diagnostics](08_Testing_debugging/02_Logging) +* [8.3 Debugging](08_Testing_debugging/03_Debugging) + +## [9. Packages](09_Packages/00_Overview) + +* [9.1 Packages](09_Packages/01_Packages) +* [9.2 Third Party Modules](09_Packages/02_Third_party) +* [9.3 Giving your code to others](09_Packages/03_Distribution) + + + + + + + + -This is contents