
Explore memory management, mutability, decorators, and async programming with threading in Python, and speed up computations using the C Python API with C or C++, plus args and kwargs.
Access the course GitHub repository, download or clone code, unzip it on desktop, and set up Python or Anaconda with a py Udemy environment in VS Code using Python 3.10.
Download the project from GitHub, locate the requirements.txt file, activate the proper Python environment, and run pip install -r requirements.txt to install all packages.
Install Visual Studio Code, a cross-platform editor that becomes an IDE with extensions; open your project, install coding tools and python dev extension packs, then generate python config files.
Explore Python type annotations, declaring parameter and return types, using unions with pipes, and leveraging type checkers to catch bugs early, while noting they are optional and serve as documentation.
Explore f-strings in Python and compare them with older methods like concatenation, percentage formatting, and str.format, highlighting faster, more readable variable interpolation with curly braces.
Explains that Python uses a single, dynamically sized integer class, memory grows with value; division yields floats, // yields integer division, and binary or hex uses 0b/0x or int(value, base).
Explore how Python uses a 64-bit float, its precision limits and memory use. Learn to compare floats with isclose, and apply rounding and tolerances to multiples like ten or hundred.
Learn the boolean type in Python, its true and false values, its subclass relationship to integers, truthiness of None, zero, and empty containers, short-circuiting with and/or, and is vs equality.
Discover Python 3.10 pattern matching with the match statement, a switch-like construct that improves readability over if-else for integer inputs, including seven, eight, or nine cases and a default underscore.
Explore how Python stores objects by printing memory addresses and treating variables as pointers. See that integers, booleans, and None share a single memory location, while lists use references.
Explore mutability in Python by comparing immutable types like int and tuple with mutable types like list, dict, and set, and learn how memory addresses and object references change.
Explore in-place operations on mutable vs immutable types, including how plus equals updates lists and memory addresses, and how shallow versus deep copies via the copy module create independent structures.
Explore how Python lists act as mutable containers that can store mixed data types, reveal their memory layout, and apply list comprehension for filtering and computing elements.
Compare tuples and lists by immutability and fixed memory addresses, and master unpacking, discarding with underscores, and asterisk packing to manage multiple return values.
Explore how dictionaries store key value pairs with immutable keys like bool, int, float, string, tuple, none; how values can be any type, and merge with unpacking and pipe syntax.
Explore how sets use hashing to store immutable values like dictionary keys, and why only immutable types qualify. Understand set comprehension and why nested set comprehensions aren't allowed.
Demonstrates that strings are immutable in Python and why you cannot update a single character. Shows memory addresses of characters and how slicing, concatenation, or replace creates new string objects.
Explore f-strings in Python to control precision and padding for numbers, print dictionary keys, escape braces, and adapt to Python 3.12 quote rules.
Explore modern path handling with pathlib in python, compare it to os.path, and learn to build absolute and relative paths, including path.join, across Windows and Unix, with file context managers.
Master Python function basics, including the default return value none, rules for parameter defaults, and the callable nature of function objects. Explore function attributes with dir and the default attribute.
Demonstrate how mutable default arguments, such as a list, persist across function calls and cause bugs, and show using None to create a new list each time.
Learn how Python handles functions with required positional arguments, optional arguments, and arbitrary arguments using *args and **kwargs, including order rules, unpacking, and practical use cases.
Learn how Python uses the slash for positional-only parameters and the star for keyword-only parameters, with examples of value and keyword inputs and their combinations.
Learn to build a Python command line parser with argparse, reading user options from sys.argv, defining mandatory and optional flags, type casting, and using parse_args to produce a namespace.
Learn to parse a variable number of command line arguments with star and plus operators in the argument method, producing lists of names and ages cast to integers or strings.
Build a pip-like command line interface using an argument parser with subparsers for install and list, supporting multiple package names and a verbose flag that prints commands.
This lecture covers closures and decorators in Python, showing how a closure uses outer variables and how a decorator wraps a function with a wrapper, handling *args and **kwargs.
Demonstrates decorators for debugging and timing, including a debug decorator that prints call details and a timer decorator that measures execution time, while preserving function metadata.
Explore python object orientation by comparing class methods and static methods, and learn how class methods create new instances while static methods offer date utilities in a date class.
Explore abstract methods and abstract classes with the ABC package and the abstractmethod decorator, showing how child classes implement blueprints and compare interfaces to inheritance with circle and square shapes.
Learn how to use Python properties to create getters, setters, and deleters for class attributes, exposing a public interface while keeping internal underscore attributes.
Explore Python dunder methods like __init__, __new__, __str__, and __repr__, and learn to implement comparisons, arithmetic, type conversion, and containers with length, get item, and set item.
Explore Python's method resolution order (MRO) and how it determines which init runs when multiple inheritance occurs, using a sample a, b, c, d hierarchy.
Explore how the type function, isinstance, and issubclass work in Python, including when to use each to check an object's class or inheritance, and the differences between isinstance and issubclass.
Explore the difference between __new__ and __init__, noting that __new__ runs before the instance exists and can return an object, while __init__ initializes it; use __new__ for singletons.
Learn how context managers implement __enter__ and __exit__ to control resource setup and teardown within a with statement, illustrated by a file open example and type-safe exceptions.
Explore how to implement custom iterators and generators in python, with __iter__ and __next__, next(), StopIteration, and yield for memory-efficient iteration.
Learn to create a custom container by inheriting from collections.abc.mutable sequence and implementing __len__, __getitem__, __setitem__, __delitem__, and insert, using a Python list as the underlying storage.
Discover how the dataclass decorator auto generates storage for annotated attributes and simplifies object creation. Learn to use slots for efficiency and field with default_factory to avoid shared mutable defaults.
This lecture compares named tuples and type dicts in Python with data classes, shows that named tuples hold immutable data, and contrasts collections.namedtuple with typing.NamedTuple, type dicts for type checking.
Explore how Python enums model distinct categories or states, using color examples, auto values, and int enum inheritance to write clear, type-safe code.
The course was updated and covers topics from Python Version 3.12!
Course Description:
The course covers intermediate to advanced Python programming techniques.
This means that the course is not aimed at programming beginners.
This course is compact, instructive, and useful. You learn not only how to use Python well, but also more abstract concepts that are transferable to other languages, as well as how to create a good programming environment.
Prerequisites:
Creating and using variables
If-statements, loops and logical expressions
Implementing your own functions and classes
Importing from external packages
In the course we will use Visual Studio Code (VSCode) as the IDE which is free for all operating systems.
I assume that you have already Python 3.8 or newer on your system, if not you could install it via Anaconda for example.
This course consists of the following topics:
Memory management of variables in Python
Mutable and Immutable Types
Shallow and Deep Copies
The correct use of containers (list, dict, set etc.)
f-Strings formatting
Functions and Decorators
args and kwargs Arguments
Object orientation and inheritance
Special Dunder Methods
Dataclass, Enum and NamedTuple
The integration of Cython
Using the Python C API (CPython)
Using PyBind11 (introductory example)
Using Numba and Mypyc
Using multiprocessing and multithreading
Global Interpreter Lock (GIL) in Python
Using asynchronous programming
Become a pro today, in the technology of tomorrow!
See you in class!
Note:
In the course, Python is installed via Anaconda. If this is not possible for you, you can also install Python from other sources.