4 Articles about Python Internals

Posted on Thu, 29 Mar 2018 in Python • Tagged with python, python internals, cpython

Maybe, knowing Python internals is not a thing you should know to be a good Python developer. However, if you want to improve your code it becomes more important. If you know it works under the hood, you write a code with less stupid mistakes and architecture issues.


Continue reading

Hash function for function in Python

Posted on Mon, 11 Sep 2017 in Python • Tagged with python, cpython

A couple of weeks ago one of my colleagues ask if Python function is possible to use as a key in dicts? Yes, it is. So, every function has a hash. But how is it calculated? Based on function name? Based on function byte code? Actually, it calculates by transforming a pointer to a function object. However, it is not so easy to find it in the CPython code.


Continue reading