Hysen Labs
Open-source project
satwikkansal/wtfpython avatar
satwikkansal

wtfpython

What the f*ck Python? 😱

37,056 stars2,665 forksPythonWTFPL
01
DEEP OPEN-SOURCE ANALYSIS

Python snippets that make you look twice

A tour of counterintuitive Python behavior, from snippets that look wrong but are not, to the ones that are genuinely strange, each explained down to what the interpreter is doing.

02
DEEP OPEN-SOURCE ANALYSIS

The premise

Python hands programmers a lot of comfort, and sometimes that comfort bites back: a snippet runs, but the result makes no sense at first sight. This repository collects such snippets and explains what is happening under the hood, covering genuinely counterintuitive cases and lesser known corners of the language alike. The author is refreshingly honest that not every entry qualifies as a true WTF. The code is Python, the license is WTFPL, which suits the name, and the repo sits around 37,000 stars.

03
DEEP OPEN-SOURCE ANALYSIS

How the author suggests reading it

Even entries that are not really WTFs, the README says, expose interesting parts of Python you may not have run into, and the author treats the collection as a nice way to learn a language's internals. Experienced Python programmers get a different invitation: treat the whole thing as a challenge and try to get most examples right on the first attempt. Some entries, the author adds, may revive old memories. Either way the payoff is the same, you learn the internals instead of memorizing the surprise.

04
DEEP OPEN-SOURCE ANALYSIS

Translations and revisions

The guide has been translated into Chinese, Vietnamese, Spanish, Korean, Russian, German, and Persian. Entries marked with an asterisk were added in the latest major revision, a small courtesy that lets returning readers jump straight to what is new. Under the WTFPL license, reuse of the content is about as unrestricted as licensing gets, which fits a project built entirely for sharing.

05
DEEP OPEN-SOURCE ANALYSIS

Editorial conclusion

It is one of the few programming repositories you can open at any page, read a single entry, and walk away knowing something new about the language you thought you knew.

06
DEEP OPEN-SOURCE ANALYSIS

Official sources

07
Community notes

Community notes