The Promise of Bounded Complexity
When Sebastian Dörn published Python lernen in abgeschlossenen Lerneinheiten with Springer Vieweg in 2020, he framed programming as a long-term cognitive endeavor closer to athletic training than to memorizing syntax. The central pedagogical claim is straightforward: competence emerges when beginners internalize one abstraction layer before advancing to the next. Each chapter functions as a “closed learning unit” – a bounded set of concepts, exercises, and worked examples designed to prevent the forward-reference confusion that plagues many introductory texts.
The approach has intuitive appeal. Isolate cognitive load. Master the for loop before meeting the list comprehension. Understand mutable references before designing class hierarchies. Yet the book never subjects this methodology to comparative evaluation. It remains a plausible hypothesis rather than a validated pedagogy.
What the Units Actually Contain
The curriculum progresses linearly from environment setup through atomic syntax, control structures, functions, regular expressions, file I/O (text, CSV, Excel), object-oriented design, and exception handling. A reference appendix covers enums, dictionaries, library surveys, email automation, coding standards, debugging tactics, and a Windows-specific deployment recipe.
Several pedagogical choices stand out. The author distinguishes functions (standalone, like max()) from methods (bound to instances, like list.sort()) – a distinction often blurred in introductory texts. An error taxonomy separates syntax errors (compile-time), runtime errors (data-dependent crashes), and logic errors (silent wrong results), the latter memorably likened to mermaids: “just because no one has seen them doesn’t mean they don’t exist.” Immediate testing after each addition is recommended to localize errors early.
Language Mechanics: Solid Foundations, Notable Absences
The book introduces variables as named memory containers created by assignment, with case-sensitive identifiers and no leading digits. Relational and logical operators yield bool values. Selection uses mandatory-indentation if/elif/else chains with a ternary A if cond else B. A key novice pitfall – confusing assignment (=) with equality (==) – is explicitly flagged.
Iteration distinguishes bounded loops (for over range) from conditional loops (while). Standard patterns include accumulation, extremum finding, filtering, and nested loops for 2D arrays. Python-specific constructs appear: enumerate(), list comprehensions ([expr for x in iterable if cond]), and nested comprehensions to avoid reference aliasing in 2D initialization ([[0 for x in range(n)] for y in range(m)]). The while-else construct – unique to Python – runs the else block when the condition becomes false, but not after break.
Functions serve as the primary decomposition mechanism. Two summation implementations illustrate algorithmic choice: iterative versus closed-form (b(b+1)/2 – (a-1)a/2). Parameter passing is described as call-by-value for primitives and call-by-reference for lists – a simplification. CPython passes all arguments by object reference; mutability determines observable effects.
What’s missing reflects the 2020 publication date: no type hints, no match/case (3.10+), no pathlib, no asyncio, no context managers, no modern packaging tooling. The with statement is absent entirely; file handles use explicit open/close. The round() banker’s rounding behavior is noted, but the binary floating-point caveat (round(2.675, 2) → 2.67) is omitted. math.isclose, math.tau, math.comb, and math.perm are nowhere to be found.
Data Structures and Objects: A Pre-3.7 Mental Model
Strings are immutable; lists are mutable, ordered, and support negative indexing and slice notation liste[a:b:c]. range(start, end, step) excludes end. Assignment creates references; copy.copy() gives shallow copies; copy.deepcopy() is needed for nested lists. sort() uses Unicode code-point order (the author says “ASCII sorting” for the ASCII subset). Tuples are immutable sequences.
Dictionaries are described as “unordered” key-value stores – a claim outdated since CPython 3.6 guaranteed insertion order, formalized in the language specification in 3.7. The enum module is introduced for symbolic constants (a Note enum mapping grade symbols to integers), but IntEnum, Flag, auto(), and StrEnum (3.11+) are absent.
Classes bundle instance variables and methods; __init__ requires self. Visibility follows convention: single underscore _ for protected, double __ for private (name-mangled to _ClassName__var), though the text incorrectly states direct access raises a syntax error rather than AttributeError. Encapsulation uses getter/setter methods with validation (a 5-digit postal code example). Class variables track instance counts; static methods (@staticmethod) operate without self. A “narrative” code layout (variables top, decreasing abstraction, ≤500 lines) is advocated as stylistic guidance.
Composition versus aggregation is introduced: Person contains an Address instance (aggregation). A five-step OO analysis maps nouns to classes and verbs to methods; dynamic lists (append()) replace fixed arrays. Inheritance is absent entirely.
Automation Pipelines: The Book’s Practical Core
Where the text shines is its worked examples for office and research workflows. File fundamentals use os.path.join() for cross-platform paths, shutil for copy/move, and send2trash as a safer alternative to os.unlink. CSV reading employs csv.reader(handle, delimiter=’;’) with two patterns: loading entire files into 2D lists (small data) or iterating line-by-line (large files). Writing uses csv.writer with lineterminator=’\n’ to override Windows defaults.
Excel via openpyxl uses 1-based indexing; examples create workbooks with multiple sheets, populate via nested loops, and read back. A batch-rename script converts MM-DD-YYYY filenames to DD-MM-YYYY using os.listdir() and regex. Regular expressions via the re module follow the workflow re.compile(pattern), pattern.search(string), match.group(). Raw strings prevent double-backslash escaping. Flags re.I and re.VERBOSE are demonstrated. Quantifiers, anchors, character classes, groups, findall() returning lists of tuples, and substitution via sub() with positional extraction via finditer() all appear.
An email automation appendix details retrieval via imapclient/pyzmail36 (IMAP) and sending via smtplib, claiming “filtering information from standard mails … in a few lines of Python.” The library versions cited (imapclient 2.1.0) and compatibility with Python 3.12+ remain unverified.
Error Handling and Debugging: Thorough but Dated
The full try-except-else-finally structure is presented; a general BaseException clause must appear last. finally is described as executing in four scenarios (normal completion, handled exception, unhandled exception, jump-statement exit) – a structural claim rather than a language guarantee; os._exit or interpreter crash bypasses finally. Custom exceptions inherit from Exception; a worked example defines DivisionException with a division() method surfacing numerator and denominator. Exception chaining (raise … from), except*, and BaseExceptionGroup (3.11+) are absent.
Six debugging tactics are listed: print intermediates, debugger, simple test cases, manual calculation, logic walkthrough, rubber-duck explanation. One listed semantic error example – “Klammern falsch geschlossen” (parentheses closed incorrectly) – typically raises SyntaxError in Python 3.x, not a silent logic flaw.
Tooling and Deployment: A 2019 Time Capsule
The development environment centers on Anaconda 2019, Spyder, and Jupyter Notebook. No venv, no pip best practices (python -m pip), no –user, no lockfiles, no pyproject.toml. The pip procedure assumes Windows “Eingabeaufforderung” and manual cd to the Python folder, risking system-package pollution.
Windows deployment uses a three-step method creating double-clickable executables via shebang #! python3, a .bat wrapper invoking py.exe with absolute path and %* for argument forwarding, and optional pause. This relies on the Windows Python launcher (py.exe) in PATH and is not cross-platform. No mention of PyInstaller, cx_Freeze, venv, or setuptools entry points.
Fourteen prescriptive coding rules govern naming, indentation, avoidance of “clever tricks,” single-responsibility methods (20-100 lines), ≤3 parameters, file length ≤500 lines, and OOP principles. Framed as mandatory team standards (“jedes Mitglied des Teams sollte dann genau diesen Stil benutzen”), they reflect a pre-Black/pre-Ruff era and conflict with modern auto-formatters.
What a Modern Learner Should Take Away
The book functions as a structured entry point for absolute beginners aiming to automate office and research workflows: data consolidation, report generation, bulk emailing, file renaming, CSV/Excel processing, and simple domain modeling. The progression from procedural scripting to OOP mirrors a typical introductory curriculum, enabling readers to build mental models of state, control flow, decomposition, and encapsulation.
Worked examples – triangle angles via law of cosines, salary calculation, screw pricing, batch rename – provide templates for similar real-world tasks. The regex, CSV, Excel, and email appendices offer immediate utility for text-processing pipelines.
However, readers must unlearn or supplement deployment and dependency-management practices. The absence of context managers, pathlib, type hints, dataclasses, virtual environments, and modern packaging means the book’s second half effectively requires a companion guide. Teams adopting the 14 prescriptive coding rules would conflict with auto-formatters (Black, Ruff) and modern style guides (PEP 8 + tooling).
The “closed learning unit” concept remains pedagogically interesting: isolate one abstraction, practice it, then advance. But the units themselves have aged. A 2024 learner opening this book will master foundational logic and automation patterns – then need to relearn file handling, packaging, and project structure from contemporary sources. The mermaids of logic errors still lurk; the tools for hunting them have changed.