TechnologyExplain Like I'm 5Intermediate
Writing Idiomatic Python, a free technology course on Tomo

Writing Idiomatic Python

Like Duolingo, but for Writing Idiomatic Python. Tomo turns the whole topic into a game you play five minutes a day, until it actually sticks.

For the part of you with thirty open tabs that never became anything.

26 levels across 4 sections, about 52 minutes end to end, roughly 10 days at five minutes a day. It moves through Writing Expressive Code, Structuring Data and Objects, Controlling Execution Flow, and Understanding the Runtime. It assumes you already know the basics.

26 bite-size levelsAbout 5 minutes each

Free forever · No credit card · iPhone & Android

Pip the Python, the guide who teaches the Writing Idiomatic Python course
Writing Idiomatic Python
with Pip the Python
26
Levels
4
Sections
5
Min/day
What you'll learn

Key ideas in Writing Idiomatic Python

  • Square brackets produce a list comprehension preserving order and duplicate items.
  • Braces without a colon construct a set comprehension that discards duplicates.
  • Braces with a colon construct a dictionary comprehension from paired elements.
  • A trailing if clause filters items before passing them to the output expression.
  • A leading if-else ternary expression transforms each item without changing list length.
  • Comprehension trailing filters discard non-matching items without requiring an else.
  • The walrus operator := assigns an expression to a name inside an inline condition.
  • Binding in the filter clause lets the leading expression reuse the result for free.
  • Assignment expressions avoid calling expensive functions twice per iteration.
  • Nested comprehension for clauses read in the same outer-to-inner order as loops.
  • The outer iterable loop must appear before the inner collection variable it unpacks.
  • Optional filter clauses evaluate after the innermost loop clause they constrain.
  • A starred variable in Python unpacking always absorbs surplus items into a list.
  • Python permits only one starred expression per assignment target.
  • Unstarred targets at both ends capture exactly one item before and after the star.
  • Loop variable targets mirror the nested tuple or list layout of each yielded item.
Why not just Google it

You've tried the other tabs

Wikipedia

Thirty open tabs. Four facts you actually kept.

YouTube

You watched. You nodded. By Sunday it was gone.

ChatGPT

One answer, then back to scrolling.

Online courses

Eight weeks. You meant to finish. You didn't.

Tomo gives Writing Idiomatic Python the Duolingo treatment: levels, streaks, and quick quizzes that test what you just learned. That game loop is what the tabs above never had, so it's the one you actually finish.

Try a question

Here's what playing it feels like

A real question from this course. Take your best guess.

Crafting Quick Python Collections

What happens when you use curly braces without a colon in `{x for x in items}`?

Get it right to open this lesson and 25 more in the app.

Course map

Where Writing Idiomatic Python takes you

Bridge the gap between working code and clean, Pythonic engineering. Learn to write expressive data transforms, robust object models, memory-efficient streams, and reusable decorators.

  1. 1

    Writing Expressive Code

    • Data Transformations with Comprehensions
    • Structural Unpacking and Pattern Matching
    • Specialized Collections from the Standard Library
  2. 2

    Structuring Data and Objects

    • Modern Class Design with Dataclasses and Dunders
    • Attribute Access and Encapsulation
  3. 3

    Controlling Execution Flow

    • Memory-Efficient Streaming with Generators
    • Deterministic Cleanup with Context Managers
    • Metaprogramming with Function Decorators
  4. 4

    Understanding the Runtime

    • The Object Model, Scopes, and Memory

4 sections · 9 units · 26 levels. Built to play, not to enroll.

How it's taught

You pick the voice

This course
Explain Like I'm 5

Writing Idiomatic Python is taught in the Explain Like I'm 5 style: no big words. promise.. Want a different feel? In the app you can spin up the same topic in any of Tomo's teaching styles. Same facts, totally different vibe.

Start free

Start Writing Idiomatic Python today.

Download Tomo, search Writing Idiomatic Python, and play your first lesson in under a minute.