miniblog.
← Back to all posts
Sep 17, 2013 at 11:26
Surprised to discover that 'foo " bar' and 'foo \" bar" are the same in Python. Not what I was expecting.
Wilfred Hughes
Related Posts
Dec 1, 2017 at 20:08
Whilst Java's ArrayList overallocates by 50%:
https://stackoverflow.com/a/14129344/509706
I'm surprised to learn that Python only overallocates lists by ~12.5%:
https://github.com/python/cpython/blob/3.6/Objects/listobject.c#L49
I was not expecting such a range of values!
java - ArrayList: how does the size increase? - Stack Overflow
cpython/Objects/listobject.c at 3.6 · python/cpython
The Python programming language. Contribute to python/cpython development by creating an account on GitHub.
Wilfred Hughes
Shared words: expecting, Surprised, Python, Not Score: 95.3
Sep 24, 2014 at 21:59
Discovered that for integers in Python, hash(x) == x (most of the time). Seems elegant, but I was not expecting it!
Wilfred Hughes
Shared words: expecting, Python, Not Score: 57.6
Mar 21, 2018 at 19:15
I'm often surprised how many methods are in the Smalltalk base classes. For example, Object has an at: message for integer access (like foo[123] in Python).
Wilfred Hughes
Shared words: Surprised, foo, Python Score: 36.5