Hacker GitHub

← All repos

satwikkansal/wtfpython

View on GitHub ↗ ★ 37,133 Python

What the f*ck Python? 😱

53 mentions on Hacker News by 43 people: 16 stories, 37 comments · first 2017-08-31 · latest 2026-08-26

Mentions per year 53 mentions · busiest year 2020 (13)
20082026
  1. You've probably just gotten used to it so you don't notice it anymore: https://github.com/satwikkansal/wtfpython (Note some of these are outdated, but some of those only mention that towards the end of the section rather than the beginning)
  2. …doesn’t have its own set of absolutely monstrous footguns? https://github.com/denysdovhan/wtfjs - https://github.com/satwikkansal/wtfpython - https://news.ycombinator.com/item?id=31216080 - https://www.dolthub.com/blog/2023-08-16-go-pitfall…
  3. Hi, author of the repo ( https://github.com/satwikkansal/wtfpython ) here, pleasantly surprised to wake up to this thread about it. The intention of the project is not to put Python in a bad light relative to other languages, the intention…
    comment by satwik · 2025-07-20 · in What the Fuck Python
  4. See also: https://github.com/satwikkansal/wtfpython The "interactive notebook" link goes to the colab page. There are many earlier threads associated with the markdown version, for example: https://news.ycombinator.com/item?id=21862073…
    comment by omoikane · 2025-07-19 · in What the Fuck Python
  5. someone should make one for Python based on https://github.com/satwikkansal/wtfpython
  6. …I'm just saying I haven't seen anything close to these things: https://github.com/denysdovhan/wtfjs https://github.com/satwikkansal/wtfpython
    comment by IshKebab · 2025-06-27 · in Weird Expressions in Rust
  7. ▲ 5
    Ask HN: Is there any programming language that doesn't have WTFs?
    story by behnamoh · 2025-04-21 · 6 comments
  8. …it a small handful of times. But it also seems like quite a source of footguns. Many examples here: https://github.com/satwikkansal/wtfpython rely on the misuse of the walrus operator.
    comment by rich_sasha · 2025-04-04 · in My Rust experience after eight years
  9. ▲ 5
    WTF Python
    story by behnamoh · 2025-01-08 · 1 comment
  10. …you were right :) I would recommend to take a look at one of my favourite repos for more[1]. [1] https://github.com/satwikkansal/wtfpython
    comment by alkh · 2024-11-04 · in Interview gone wrong
  11. To be fair, there are edge cases [0] when it does look weird. [0] https://github.com/satwikkansal/wtfpython?tab=readme-ov-file...
    comment by throwaway313373 · 2024-11-04 · in Interview gone wrong
  12. See this for an explanation - https://github.com/satwikkansal/wtfpython?tab=readme-ov-file... > all([]) returns True since the iterable is empty.
  13. ▲ 251
    WTFPython: Exploring and understanding Python through surprising snippets
    story by Tomte · 2023-08-27 · 80 comments
  14. …# AssertionError because it was interpreted as # `(1 < 2) and (2 == should_be_ascending)` [1]: https://github.com/satwikkansal/wtfpython
    comment by BoppreH · 2023-06-11 · in This is valid Python syntax
  15. See https://github.com/satwikkansal/wtfpython "Mutating the immutable" is my personal favourite - the second line of code fails with an exception despite having already succeeded: >>> t = ([1, 2], 5, 6) >>> t[0] += [3, 4] TypeError:…
    comment by pansa2 · 2023-03-30 · in Wat [video] (2012)
  16. You'll have better results with https://github.com/satwikkansal/wtfpython
    comment by asicsp · 2023-03-30 · in Wat [video] (2012)
  17. …snippets helpful for learning a new language : https://github.com/jackzhenguo/python-small-examples https://github.com/satwikkansal/wtfpython/blob/master/README... https://www.30secondsofcode.org/python/p/1 Finally, "The Hitchhiker’s Guide…
  18. See also related: "What the fuck Python?" https://github.com/satwikkansal/wtfpython Along with the corresponding HN discussion: https://news.ycombinator.com/item?id=31566031 (450 points, 153 comments)
  19. …default arguments is the one I see most likely to come up regularly, it's gotten us a few times: https://github.com/satwikkansal/wtfpython#-beware-of-default...
  20. ▲ 460
    WTFPython: Exploring and understanding Python through surprising snippets
    story by gilad · 2022-05-31 · 139 comments
  21. …vein you may like "WTF Python: Exploring and understanding Python through surprising snippets": https://github.com/satwikkansal/wtfpython HN thread: https://news.ycombinator.com/item?id=26097732 (163 comments) PS: found with a site I'm…
  22. …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…
    comment by Izkata · 2021-02-25 · in Python for Lisp Programmers (2000)
  23. …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…
    comment by jxy · 2021-02-24 · in Python for Lisp Programmers (2000)
  24. …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, I agree, it's a pretty good going :-)
  25. …me to sell it on its elegance. There's just no _need_. It's already the #1 example of wtfpython https://github.com/satwikkansal/wtfpython#-first-things-firs... /rant. Those kind of features are going to keep coming anyway, I'm afraid.
  26. …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…
  27. …that it was cause by a bug in my code, thanks for pointing this out - now I know what caused this https://github.com/satwikkansal/wtfpython#-beware-of-default...
  28. ▲ 359
    WTF Python: Exploring and understanding Python through surprising snippets
    story by srathi · 2021-02-11 · 162 comments
  29. …* https://python-patterns.guide/ by Brandon Rhodes --> inspired from Gang of Four book * https://github.com/satwikkansal/wtfpython (this is more of a collection) --> Exploring and understanding Python through surprising snippets Also, my…
    comment by asicsp · 2020-12-15 · in Legally Free Python Books List
  30. …quickly whether the claimed skills are actually there or not. For example, the easier sections in > https://github.com/satwikkansal/wtfpython might give you a hint for topics that most seasoned Python programmers should know blindfolded…
  31. There's a repo dedicated for such snippets: https://github.com/satwikkansal/wtfpython
    comment by asicsp · 2020-10-10 · in So you think you know Python
  32. …had when they were learning python. And which entry it is is usually different between them. [0] https://github.com/satwikkansal/wtfpython
  33. This repo may be helpful to you: https://github.com/satwikkansal/wtfpython It’s a collection of snippets to explain behaviors that may be considered unexpected.
  34. …[0] the first time in my code and couldn't find the reason why my unit tests where failing. [0] https://github.com/satwikkansal/wtfpython#-a-tic-tac-toe-whe...
  35. ▲ 3
    What the F*ck Python?
    story by JoachimS · 2020-05-02 · 2 comments
  36. If anyone's looking for some more good WTFs in Python: https://github.com/satwikkansal/wtfpython
  37. > Python is a good language because it's readable and writeable. https://github.com/satwikkansal/wtfpython
    comment by wolfgke · 2020-04-28 · in SICP in Python
  38. ▲ 3
    Exploring and understanding Python through surprising snippets
    story by feross · 2020-01-17 · 0 comments
  39. ▲ 2
    Exploring Python through counter-intuitive snippets
    story by ausjke · 2020-01-12 · 1 comment
  40. ▲ 1
    Exploring Python through counter-intuitive snippets
    story by pjmlp · 2020-01-10 · 0 comments
  41. ▲ 1
    Exploring Python through counter-intuitive snippets
    story by gilad · 2020-01-06 · 0 comments
  42. ▲ 4
    WTF Python: Exploring and understanding Python through surprising snippets
    story by ingve · 2019-12-26 · 0 comments
  43. …the "default parameter" version relies on a feature that also gives rise to another WTPython entry: https://github.com/satwikkansal/wtfpython/blob/master/README...
  44. …following is valid typed code and my personal favorite WTF: def func() -> int: return True Because: https://github.com/satwikkansal/wtfpython/blob/master/README... I understand the decision that was made in the python 2 era. Nowadays…
  45. Pls read again https://github.com/satwikkansal/wtfpython#-mutating-the-immu...
  46. the first really wtf thing on there is https://github.com/satwikkansal/wtfpython/blob/master/README... where both effect and exception happen; up to that point it's business as usual with garden variety corner cases or implementation…
  47. ▲ 396
    WTFPython – Understanding Python through surprising snippets
    story by throwaway_shame · 2019-12-23 · 185 comments
  48. …enjoy "WTF, JS?" https://github.com/denysdovhan/wtfjs Or it's slightly older brother "WTF, Python?" https://github.com/satwikkansal/wtfpython
  49. ▲ 2
    Surprising python snippets
    story by pplonski86 · 2018-12-20 · 0 comments
  50. If you think that's funny, here's a nice overview over some python gotchas: https://github.com/satwikkansal/wtfPython
    comment by dakra · 2018-03-13 · in PyTorch – Internal Architecture Tour