argmax in pure Python Python does not have an inbuilt argmax function. numpy does. Here is one implementation. def argmax(ls : list) -> int: _m, _mi = -math.inf, …
Debugging python extension in gdb $ gdb -ex r --args python myscript.py If you are using virtual environment then you are likely to run into the following error. …
In Python3, converting slice to range If you want to override [] operator in Python, you may need to handle slice as well. For example in the following __getindex__ method which …
Managing multiple versions of Python using pyenv I recently discovered pyenv. I think it’s cool. It lets me setting up Python version easily on my Linux box. It is not written in Python and …