Skip to content
Browse the library
satwikkansal / wtfpython

What the fck Python

Exploring and understanding Python through surprising snippets

Who it is for

Python readers who want to investigate surprising snippets and language behavior.

What you can do with it

Predict an example’s result before reading the explanation, then use a small change to test your understanding.

Before you start

Surprising behavior can depend on interpreter details or versions. These examples are not a recommended style guide or a sequential introduction.

Prerequisites

Be comfortable reading short Python programs and identifying the interpreter version used for a result.

Costs and external services

Local examples require a suitable Python environment; check separate requirements for interactive hosted versions.

Try this first

Choose one snippet, write down your prediction, and compare it with the explanation and your interpreter’s output.

Source and context

These selection notes describe the resource's scope. Check the source for current details.

Selection notes updated . How selection notes are reviewed.

Choose your next step

Keep exploring

Explore the category →