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
20082026
-
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)
comment by Izkata · 2026-08-26 · in Python's pre-declared constants are kinda weird -
…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…
comment by maccard · 2026-08-14 · in an ambiguity in C89 which will never be fixed -
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 -
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 -
someone should make one for Python based on https://github.com/satwikkansal/wtfpython
comment by nikolayasdf123 · 2025-07-12 · in New Date("wtf") – How well do you know JavaScript's Date class? -
…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 -
…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 -
…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 -
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 -
See this for an explanation - https://github.com/satwikkansal/wtfpython?tab=readme-ov-file... > all([]) returns True since the iterable is empty.
comment by budafish · 2024-09-04 · in Layman's Guide to Python Built-in Functions -
…# 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 -
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) -
You'll have better results with https://github.com/satwikkansal/wtfpython
comment by asicsp · 2023-03-30 · in Wat [video] (2012) -
…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…
comment by CrypticShift · 2022-11-23 · in Ask HN: What are the best tutorial sites for Python? -
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)
comment by metadat · 2022-06-05 · in Abmagick – abuse ImageMagick to create arbitrary files -
…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...
comment by Izkata · 2022-05-31 · in WTFPython: Exploring and understanding Python through surprising snippets -
…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…
comment by xojoc · 2021-10-12 · in Understanding Python through its builtins -
…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) -
…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) -
…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 :-)
comment by cs702 · 2021-02-15 · in Python strings are immutable, but only sometimes -
…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.
comment by more-coffee · 2021-02-13 · in Google is now a Visionary Sponsor of the Python Software Foundation -
…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…
comment by quietbritishjim · 2021-02-11 · in WTF Python: Exploring and understanding Python through surprising snippets -
…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...
comment by matkoniecz · 2021-02-11 · in WTF Python: Exploring and understanding Python through surprising snippets -
…* 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 -
…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…
comment by wolfgke · 2020-10-20 · in My platonic ideal for how engineering hiring should work -
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 -
…had when they were learning python. And which entry it is is usually different between them. [0] https://github.com/satwikkansal/wtfpython
comment by Izkata · 2020-08-23 · in Never run ‘python’ in your downloads folder -
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.
comment by stummjr · 2020-06-20 · in Ask HN: Website listing/explaining common Python pitfalls&tricks? -
…[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...
comment by giu · 2020-05-02 · in Why does `True == False is False` evaluate to False in Python? (2013) -
If anyone's looking for some more good WTFs in Python: https://github.com/satwikkansal/wtfpython
comment by Figs · 2020-05-02 · in Why does `True == False is False` evaluate to False in Python? (2013) -
> 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 -
…the "default parameter" version relies on a feature that also gives rise to another WTPython entry: https://github.com/satwikkansal/wtfpython/blob/master/README...
comment by Izkata · 2019-12-23 · in WTFPython – Understanding Python through surprising snippets -
…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…
comment by rvanlaar · 2019-12-23 · in WTFPython – Understanding Python through surprising snippets -
Pls read again https://github.com/satwikkansal/wtfpython#-mutating-the-immu...
comment by avip · 2019-12-23 · in WTFPython – Understanding Python through surprising snippets -
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…
comment by baq · 2019-12-23 · in WTFPython – Understanding Python through surprising snippets -
…enjoy "WTF, JS?" https://github.com/denysdovhan/wtfjs Or it's slightly older brother "WTF, Python?" https://github.com/satwikkansal/wtfpython
comment by olooney · 2019-08-16 · in Why is the result of ('b'+'a'+ + 'a' +'a').toLowerCase() 'banana'? -
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