Python Functions Explained
Learn what Python functions are, why they matter for organizing code, and how they form the foundation of non-trivial programs.
Learn Python programming from scratch
Learn what Python functions are, why they matter for organizing code, and how they form the foundation of non-trivial programs.
Learn how Python functions send results back with the return statement, how to return multiple values, and the difference between returning and printing.
Understand Python's LEGB scope rules: local, enclosing, global, and built-in. Learn where variables are visible and why functions isolate their local state.
Learn the practical differences between local and global variables, when to use each, and how to avoid the most common scope-related bugs in Python functions.
Master the two ways to pass arguments to Python functions: by position and by keyword. Learn the rules for mixing them and when to choose each style.
Learn how *args lets Python functions accept any number of positional arguments, how it works under the hood as a tuple, and when to use it in your own functions.
Understand the differences between Python's built-in functions and the functions you write yourself, including performance, availability, and how they work together.
Learn the principles of writing reusable Python functions: single responsibility, clear interfaces, avoiding global state, and designing for composition.
Learn how to read and write large files in Python without running out of memory, using chunked reading, line-by-line iteration, and buffered writes.
Learn how to copy Python objects using shallow and deep copy, how the copy module works, and how to implement __copy__ and __deepcopy__ for custom classes.
Learn how to design Python classes that are reusable across projects, with clean interfaces, minimal dependencies, and patterns that make your code a joy to work with.
Learn the best practices for designing Python classes, from the SOLID principles adapted for Python to practical guidelines for writing maintainable object-oriented code.