When using data related python libraries (pandas, numpy, etc.) a lot of the functions accept an inplace parameter. By setting it to True , we change the source object without creating an additional copy, in some cases this can have a significant memory impact. In this article I’ll show that we can automatically detect some patterns where using inplace=True has no downsides: # There are no other…
Linked lists are often overused in introductory algorithmics courses, due to a heavy focus on theorical complexities. Unfortunatly, in practice, computers are complex beasts. They don’t execute instructions sequentially 1 with the same cost 2 . This means that a data structure with faster theorical complexities does not necessarily translate to a more efficient data structure in practice. In this…
In the software engineering world testing is important, unfortunately in your career you may find yourself working on software that does not have automated tests. In my own experience this can be quite frequent in research based projects. Since a fair amount of those projects starts as a POC or multiple scripts where the emphasis is more on exploration and research than producing high quality code…
In this article, we will read and discuss the implementation details of ints in CPython . Altough using integers in python is fairly easy : a = 1 b = a + 5 The implementation file contains more than 5000 code lines. Since the file contains roughly 116 functions/macros, I’ll probably skip some (most of ?) functions. Without further ado, let’s dive into the code ! longobject.c First we need to find…
The purpose of this serie is to review some parts of the CPython ’s code. Why ? Well there are multiple reasons : Because we can. The project is opensource and the source code is freely available here : https://github.com/python/cpython I strongly believe that we, as developpers, can learn a lot by studying good and clean code. And I think we can safely assume that CPython’s code, which is used…