The Subtitle as Manifesto
The German title Einfach Python: Gleich richtig programmieren lernen translates to “Simply Python: Learn to Program Correctly Right Away.” That subtitle is not marketing fluff; it is the organizing principle of the entire 15-chapter curriculum. Michael Inden, a Diplom-Informatiker with two decades in industry roles from team lead to CTO, argues that beginners should internalize professional habits immediately – explicit structure over clever brevity, composition over nesting, value-based iteration over index manipulation, and resource safety via context managers. Readability, in his framing, is a long-term economic advantage: easier changes, fewer defects, better testability.
The book targets absolute beginners – students, career changers, hobbyists – and assumes no prior programming experience beyond basic software installation and command-line familiarity. Yet it refuses to treat novices as fragile. Chapters 1 through 6 must be read in order. Chapter 6 deliberately withholds the ternary operator, Enum, and parameter nuances (*args/**kwargs) until the learner has felt the pain points those features resolve. This “problem-first” design means syntax arrives when it has a job to do.
Composition Over Nesting: A Recurring Refactor
One of the clearest expressions of the book’s philosophy appears early: a nested min_of_3 function is refactored into a helper min_of called twice. The nested version is labeled error-prone (“Flüchtigkeitsfehler”) and harder to verify. This principle recurs throughout. A CounterWithOverflow class favors composition – embedding a Counter instance – over inheritance. The capstone word-puzzle generator separates concerns into Model, HtmlCreator, View, and WordViewApplication classes. Each decomposition models the same idea: build small, verifiable pieces and combine them.
For a learner, this is more than a style tip. It teaches that the first working solution is rarely the final one, and that restructuring is not a failure but a normal step in professional development.
Value-Based Iteration as Default
Section 8 makes an explicit recommendation: for x in seq for readability, enumerate(seq) when position matters. Index-based loops – for i in range(len(seq)) – are deemed “stilistisch unschön” (stylistically unsightly). The same bias appears in comprehensions and generator expressions, which are preferred over filter/map/reduce with lambdas. The author contrasts lambda-based approaches with list comprehensions, arguing the latter are “deutlich besser verständlich” (clearly more understandable), especially when tuple unpacking eliminates indexed access: sum(x*y for x, y in pairs).
This is not mere aesthetics. Value-based iteration reduces off-by-one errors, works uniformly across sequences, and composes naturally with other Python constructs. A beginner who internalizes this default avoids a whole class of index-management bugs.
Immutability and Reference Semantics from Day One
Strings are introduced as immutable sequences – no separate char type exists. Every “modification” returns a new object. Class variables hold references; multiple variables can reference the same object, and attribute changes via one are visible through all. None removes a reference without affecting others. The author implements __repr__ by delegating to __str__ for simplicity, while noting the ideal is a recreatable string.
These concepts are often deferred in introductory materials, treated as advanced topics. Inden presents them immediately because they explain behavior that beginners otherwise experience as mysterious: why a string doesn’t change in place, why two lists appear to share data, why a function can mutate an argument’s contents but not replace the argument itself.
Encapsulation by Convention, Not Enforcement
Python lacks enforced visibility modifiers. A single underscore _ signals “private by convention.” Double underscore __ triggers name mangling to _ClassName__attribute, primarily for inheritance isolation, not true privacy. The author is explicit: name mangling is not security (_Car__brand remains accessible), single underscore relies on discipline, and modern alternatives (__slots__, dataclasses, attrs) are not discussed in this edition.
The Car class evolves across chapters: public attributes → mangled attributes with getters → @property with a setter raising ValueError for horsepower outside a valid range. This progression shows encapsulation as a spectrum of increasing rigor, each step solving a concrete problem the previous step left open.
Polymorphism Over Type Inspection
Section 16 warns that isinstance()/issubclass() checks violate the Open/Closed Principle. The alternative is polymorphic dispatch via Method Resolution Order (MRO). A four-step workflow extracts base classes: identify candidates, create hierarchy, move commonalities up, remove duplicates – exemplified by unifying inconsistent figure-drawing methods under a shared BaseFigure.draw().
This is a subtle but powerful lesson. Beginners often reach for type checks because they mirror how we categorize things in everyday language. The book shows that object-oriented design works better when behavior is attached to the object, not scattered across conditional branches.
Generators as Lazy, Stateful Sequences
A function containing yield automatically implements __iter__/__next__, preserves local state between calls, and raises StopIteration on completion. The author emphasizes that generator functions “pause execution at each yield, retaining variable bindings.” Infinite generators (e.g., Fibonacci) place termination responsibility on the caller.
The contrast with a custom iterator class – FactorialIterator at roughly 15 lines versus a 6-line generator function yielding cumulative factorials (1, 2, 6, 24, 120) – makes the case concretely. Generators are not just syntactic sugar; they are a distinct abstraction for lazy, stateful sequences that would otherwise require boilerplate.
Context Managers as Non-Negotiable Resource Safety
The with statement (context manager protocol __enter__/__exit__) is endorsed as the “elegant” standard for automatic closure, avoiding leaks from exceptions. Section 35 demonstrates placing with open(…) as file: inside the try block so that FileNotFoundError (a subclass of OSError/IOError) is caught by except IOError, while the file is still closed automatically if opening succeeds.
This detail matters. Many tutorials show with outside try, which works for the happy path but obscures the interaction between exception handling and resource cleanup. The book’s approach models the precision required in production code.
Defensive I/O with Partial Results
The CSV high-score parser demonstrates defensive parsing: with open(), split(“,”), explicit column-count validation (len(values) != 3), whitespace stripping, and try/except ValueError for numeric coercion. On IOError it returns partial results – a design choice, not a language requirement. The author prefers len(values[0].strip()) == 0 over not values[0].strip() for clarity at “this technical level.”
This is where the book’s industry experience shows. Real-world data is messy. A parser that fails completely on one bad row loses all the good data. Returning partial results with logged errors is often the right operational behavior, and the code demonstrates it without fanfare.
Style as Economic Advantage: The count_substrings Case
Section 40 contrasts verbose recursive functions with compact ternary variants, arguing verbose versions ease modification and testing. A concrete divergence appears in count_substrings: the verbose version advances by match length (non-overlapping), while the short version advances by one character (overlapping). Searching for “XX” in “XXXX” yields 2 versus 3.
This is not a style preference; it is a semantic difference disguised as a style choice. The compact version behaves differently. The book uses this to illustrate that “pythonic” brevity can change program meaning, and that explicit, testable code is a safer default for maintainers who will read the code far more often than they write it.
IDE-First Workflow: PyCharm from Day One
The book adopts an IDE-first workflow centered on PyCharm (Community or Ultimate), providing detailed, version-specific installation instructions for Windows (manual PATH addition for Python directory and Scripts subdirectory) and macOS (automatic PATH typical; manual fallback via export PYTHON_HOME and PATH update in ~/.bash_profile or ~/.zshrc). Project creation, first-run execution, and recommended installation options (64-bit launcher, PATH entry) are covered. Verification uses python (Windows) or python3 (macOS) showing 3.9.6.
This reduces environment friction for novices but assumes local admin rights and a desktop installation – no browser-based alternative (Colab, replit) is discussed. The trade-off is deliberate: a professional toolchain from the start, with debugging, refactoring, and inspection tools that scale beyond the first semester.
Capstone Projects: Portfolio-Ready Artifacts
Part III presents three capstone projects. Tic Tac Toe models modular design with Model-View separation. The CSV high-score parser demonstrates defensive I/O and namedtuple usage. The word-puzzle generator builds a fixed 20×10 board, uses enum.Enum of namedtuple step vectors (e.g., NE = dxdy(1, -1)), implements immutable Position objects returning new instances via adjust_to_dir(), validates word placement with bounds and empty-cell checks, and exports HTML via triple-quoted strings. A hard-coded webbrowser.get(“firefox”) in the viewer is a minor platform-specific quirk.
These projects are not toys. They demonstrate modular decomposition, file I/O, data validation, and visualization – artifacts a learner can show in a portfolio.
Testing with pytest, Not Ad-Hoc Scripts
Chapter 15 introduces pytest (AAA pattern, test_ naming, python3 -m pytest, optional HTML reports via pytest-html) rather than ad-hoc scripts. This aligns with industry practice and reinforces the book’s theme: the tools and habits you start with should be the ones you keep using.
What the Book Deliberately Omits
The book stops at the standard library. No virtual environments, pip packaging, type hinting (beyond 3.10’s | union), async I/O, or external libraries (NumPy, pandas, requests) are covered. Learners needing those topics must supplement elsewhere. The German-only text limits accessibility for English-speaking audiences. The Python 3.9.6 baseline with a 3.10 appendix means 3.11+ changes (exception groups, tomllib, Self type, 3.12 f-string improvements) are absent.
These omissions are not flaws; they are boundaries. A semester-length introductory course cannot cover the entire ecosystem. The book’s value is in what it does cover deeply: the habits that make everything else easier to learn later.
Applying the Philosophy Beyond This Book
The lessons transfer regardless of language or resource. Defer convenience features until you understand the problem they solve. Prefer composition over inheritance, value-based iteration over index manipulation, explicit structure over clever brevity. Treat context managers as non-negotiable. Write defensive I/O that preserves partial results. Choose verbose, testable code over compact code that may behave differently than it appears. Start with a professional toolchain. Build portfolio-ready projects that demonstrate modular design.
Inden’s subtitle – “learn to program correctly right away” – is ambitious. No book can guarantee correctness. But a curriculum that treats professional habits as the baseline, not the advanced topic, gives learners a foundation that won’t need unlearning.