Python 3: Deep Dive (Part 1 – Functional)

Python 3: Deep Dive (Part 1 – Functional)

English | MP4 | AVC 1280×720 | AAC 48KHz 2ch | 162 lectures (46h 6m) | 19.38 GB

Variables, Functions and Functional Programming, Closures, Decorators, Modules and Packages

This is Part 1 of a series of courses intended to dive into the inner mechanics and more complicated aspects of Python 3.

This is not a beginner course!

If you’ve been coding Python for a week or a couple of months, you probably should keep writing Python for a bit more before tackling this series.

On the other hand, if you’ve been studying or programming in Python for a bit, and are now starting to ask yourself questions such as:

  • I wonder how this works?
  • is there another, more pythonic, way, of doing this?
  • what’s a closure? is that the same as a lambda?
  • I know how to use a decorator someone else wrote, but how does it work? How do I write my own?
  • why do some boolean expressions not return a boolean value? How can I use that to my advantage?
  • how does the import mechanism in Python work, and why am I getting side effects?
  • and similar types of question…

then this course is for you.

To get the most out of this course, you should be prepared to pause the coding videos, and attempt to write code before I do! Sit back during the concept/theory videos, but lean in for the code videos!

Please make sure you review the pre-requisites for this course (below) – although I give a brief refresh of basic concepts at the beginning of the course, those are concepts you should already be very comfortable with as you being this course.

In this course series, I will give you a much more fundamental and deeper understanding of the Python language and the standard library.

Python is called a “batteries-included” language for good reason – there is a ton of functionality in base Python that remains to be explored and studied.

So this course is not about explaining my favorite 3rd party libraries – it’s about Python, as a language, and the standard library.

In particular this course is based on the canonical CPython. You will also need Jupyter Notebooks to view the downloadable fully-annotated Python notebooks.

It’s about helping you explore Python and answer questions you are asking yourself as you develop more and more with the language.

In Python 3: Deep Dive (Part 1) we will take a much closer look at:

  • Variables – in particular that they are just symbols pointing to objects in memory (references)
  • Namespaces and scopes
  • Python’s numeric types
  • Python boolean type – there’s more to a simple or statement than you might think!
  • Run-time vs compile-time and how that affects function defaults, decorators, importing modules, etc
  • Functions in general (including lambdas)
  • Functional programming techniques (such as map, reduce, filter, zip, etc)
  • Closures
  • Decorators
  • Imports, modules and packages
  • Tuples as data structures
  • Named tuples

What you’ll learn

  • An in-depth look at variables, memory, namespaces and scopes
  • A deep dive into Python’s memory management and optimizations
  • In-depth understanding and advanced usage of Python’s numerical data types (Booleans, Integers,
  • Floats, Decimals, Fractions, Complex Numbers)
  • Advanced Boolean expressions and operators
  • Advanced usage of callables including functions, lambdas and closures
  • Functional programming techniques such as map, reduce, filter, and partials
  • Create advanced decorators, including parametrized decorators, class decorators, and decorator classes
  • Advanced decorator applications such as memoization and single dispatch generic functions
  • Use and understand Python’s complex Module and Package system
  • Idiomatic Python and best practices
  • Understand Python’s compile-time and run-time and how this affects your code
  • Avoid common pitfalls
Table of Contents

Introduction
1 Course Overview
2 Pre-Requisites
3 Code Projects and Notebooks
4 Course Slides

A Quick Refresher – Basics Review
5 Introduction
6 The Python Type Hierarchy
7 Multi-Line Statements and Strings
8 Variable Names
9 Conditionals
10 Functions
11 The While Loop
12 Break, Continue and the Try Statement
13 The For Loop
14 Classes

Variables and Memory
15 Introduction
16 Variables are Memory References
17 Reference Counting
18 Garbage Collection
19 Dynamic vs Static Typing
20 Variable Re-Assignment
21 Object Mutability
22 Function Arguments and Mutability
23 Shared References and Mutability
24 Variable Equality
25 Everything is an Object
26 Python Optimizations Interning
27 Python Optimizations String Interning
28 Python Optimizations Peephole

Numeric Types
29 Introduction
30 Integers Data Types
31 Integers Operations
32 Integers Constructors and Bases – Lecture
33 Integers Constructors and Bases – Coding
34 Rational Numbers – Lecture
35 Rationals Numbers – Coding
36 Floats Internal Representations – Lecture
37 Floats Internal Representations – Coding
38 Floats Equality Testing – Lecture
39 Floats Equality Testing – Coding
40 Floats Coercing to Integers – Lecture
41 Floats Coercing to Integers – Coding
42 Floats Rounding – Lecture
43 Floats Rounding – Coding
44 Decimals – Lecture
45 Decimals – Coding
46 Decimals Constructors and Contexts – Lecture
47 Decimals Constructors and Contexts – Coding
48 Decimals Math Operations – Lecture
49 Decimals Math Operations – Coding
50 Decimals Performance Considerations
51 Complex Numbers – Lecture
52 Complex Numbers – Coding
53 Booleans
54 Booleans Truth Values – Lecture
55 Booleans Truth Values – Coding
56 Booleans Precedence and Short-Circuiting – Lecture
57 Booleans Precedence and Short-Circuiting – Coding
58 Booleans Boolean Operators – Lecture
59 Booleans Boolean Operators – Coding
60 Comparison Operators

Function Parameters
61 Introduction
62 Argument vs Parameter
63 Positional and Keyword Arguments – Lecture
64 Positional and Keyword Arguments – Coding
65 Unpacking Iterables – Lecture
66 Unpacking Iterables – Coding
67 Extended Unpacking – Lecture
68 Extended Unpacking – Coding
69 args – Lecture
70 args – Coding
71 Keyword Arguments – Lecture
72 Keyword Arguments – Coding
73 kwargs
74 Putting it all Together – Lecture
75 Putting it all Together – Coding
76 Application A Simple Function Timer
77 Parameter Defaults – Beware!!
78 Parameter Defaults – Beware Again!!

First-Class Functions
79 Introduction
80 Docstrings and Annotations – Lecture
81 Docstrings and Annotations – Coding
82 Lambda Expressions – Lecture
83 Lambda Expressions – Coding
84 Lambdas and Sorting
85 Challenge – Randomize an Iterable using Sorted!!
86 Function Introspection – Lecture
87 Function Introspection – Coding
88 Callables
89 Map, Filter, Zip and List Comprehensions – Lecture
90 Map, Filter, Zip and List Comprehensions – Coding
91 Reducing Functions – Lecture
92 Reducing Functions – Coding
93 Partial Functions – Lecture
94 Partial Functions – Coding
95 The operator Module – Lecture
96 The operator Module – Coding

Scopes, Closures and Decorators
97 Introduction
98 Global and Local Scopes – Lecture
99 Global and Local Scopes – Coding
100 Nonlocal Scopes – Lecture
101 Nonlocal Scopes – Coding
102 Closures – Lecture
103 Closures – Coding
104 Closure Applications – Part 1
105 Closure Applications – Part 2
106 Decorators (Part 1) – Lecture
107 Decorators (Part 1) – Coding
108 Decorator Application (Timer)
109 Decorator Application (Logger, Stacked Decorators)
110 Decorator Application (Memoization)
111 Decorator Factories – Lecture
112 Decorator Factories – Coding
113 Decorator Application (Decorator Class)
114 Decorator Application (Decorating Classes)
115 Decorator Application (Dispatching) – Part 1
116 Decorator Application (Dispatching) – Part 2
117 Decorator Application (Dispatching) – Part 3

Tuples as Data Structures and Named Tuples
118 Introduction
119 Tuples as Data Structures – Lecture
120 Tuples as Data Structures – Coding
121 Named Tuples – Lecture
122 Named Tuples – Coding
123 Named Tuples – Modifying and Extending – Lecture
124 Named Tuples – Modifying and Extending – Coding
125 Named Tuples – DocStrings and Default Values – Lecture
126 Named Tuples – DocStrings and Default Values – Coding
127 Named Tuples – Application – Returning Multiple Values
128 Named Tuples – Application – Alternative to Dictionaries

Modules, Packages and Namespaces
129 Introduction
130 What is a Module
131 How does Python Import Modules
132 Imports and importlib
133 Import Variants and Misconceptions – Lecture
134 Import Variants and Misconceptions – Coding
135 Reloading Modules
136 Using __main__
137 Modules Recap
138 What are Packages – Lecture
139 What are Packages – Coding
140 Why Packages
141 Structuring Packages – Part 1
142 Structuring Packages – Part 2
143 Namespace Packages
144 Importing from Zip Archives

Python Updates
145 Python 3.10
146 Python 3.9
147 Python 3.8 3.7
148 Python 3.6 Highlights
149 Python 3.6 – Dictionary Ordering
150 Python 3.6 – Underscores in Numeric Literals
151 Python 3.6 – Preserved Order of kwargs and Named Tuple Application
152 Python 3.6 – f-Strings

Extras
153 Introduction
154 Additional Resources
155 Random Seeds
156 Random Choices
157 Random Samples
158 Timing code using timeit
159 Don’t Use args and kwargs Names Blindly
160 Command Line Arguments
161 Sentinel Values for Parameter Defaults
162 Simulating a simple switch in Python

Homepage