HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
satwikkansal
wtfpython
Python2017–2026
satwikkansal / wtfpython

wtfpython

What the f*ck Python? đŸ˜±

43Distinct people
53Mentions
1Explicit recommenders
37.1KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

What the f*ck Python? đŸ˜±

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

Yes, of course. BTW, that's not the "biggest" WTF feature; it's just my favorite. There's a long list of WTF features here: https://github.com/satwikkansal/wtfpython Otherwise,


cs702 used a recommendation phrase. One indexed comment matches. This is a phrase match, not a verdict.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 6:01:08 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year53 dated mentions

Observed mentions: 2017-08-31 14:14:16 UTC to 2026-08-26 02:55:54 UTC.

0510152017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 3 mentions; 3 submissions, 0 comments20172018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 2 mentions; 1 submissions, 1 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 7 mentions; 2 submissions, 5 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 13 mentions; 5 submissions, 8 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 8 mentions; 1 submissions, 7 comments20212022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 4 mentions; 1 submissions, 3 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 4 mentions; 1 submissions, 3 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 7 mentions; 2 submissions, 5 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC330
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC211
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC725
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC1358
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC817
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC413
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC413
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC303
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC725
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC202

What Hacker News says

8 sources
> But most "wtfpython" things don't actually affect people using the language Plenty do though. I've passed that page onto co-workers a lot, back when the list was smaller, and almost every time they've found something on the page that explains a bit of weirdness with Python that they'd just dismissed as buggy behavior and avoided touching. The ones I remember them mentioning: https://github.com/satwikkansal/wtfpython#-mutating-the-immu... https://github.com/satwikkansal/wtfpython#-beware-of-default... And I multiple times I've had to explain the difference between references / shallow copy / deep copy to bootcampers, which falls under https://github.com/satwikkansal/wtfpython#-a-tic-tac-toe-whe...
In Python for Lisp Programmers (2000)
Python had their smearing campaign claiming TIOOWTDI against Perl's TIMTOWTDI, and dubious claim's of sigils (`@$`) hurt readability. But once Python had the ecosystem going, it brought back `@`, `{}`, numerous `_`, fanciful `:=`. And, of course, there always is more than one way to do it in Python. Python's "easy to use" is just a lie, https://github.com/satwikkansal/wtfpython The common lisp CFFI module is nothing short of Python's. But, I know, people hate to put their `(` in front of their function names, and people hate to omit `,` between there function arguments.
In Python for Lisp Programmers (2000)
You're talking about something different. The parent comment is about mutable default arguments are shared between all calls to that function [1], but you seem to be talking about functions defined in for loops all sharing a reference to the same variable [2]. [1] https://github.com/satwikkansal/wtfpython#-beware-of-default... [2] https://github.com/satwikkansal/wtfpython#-loop-variables-le... > In this example it's just a constant but this trick is often used with mutable defaults. Your example doesn't work with mutable defaults. Ironically it falls into the trap the parent comment was referring to! def main(): funcs = [] arg = [] for x in range(10) arg.append(x) def f(arg=arg): return arg funcs.append(f) print(*[f() for f in funcs], sep="\n")
Read the rest
# result: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] printed 10 times These functions will all return the same 10-element list. Instead you need to use `def f(arg=arg[:])` or `def f(arg=copy(arg))` (after from copy import copy). > print([f(x) for f in funcs]) Just a typo but you meant print([f() for f in funcs])
In WTF Python: Exploring and understanding Python through surprising snippets

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.