When writing a program, making sure it works the way it’s supposed to is a crucial part of the process. This means you have to test your code, and you almost always end up with bugs that you have to debug.
When you are using a IDE, you often have nice tools to do that, with the ability to place breakpoints, observe the call stack, the content of the locals… But sometimes you find yourself in situation where your program lives somewhere else and you can’t use those nice modern tools, and you have to find an other solution.
If you are using Python, have some good news for you: the standard lib comes with a basic debugger included, pdb which we’ll discover today.
In a recent post about the __path__
attribute, I explained that it would be possible to manipulate a library’s path to dynamically extend its functionalities. At the end of my article I detailed that this possibility has already been thought of was integrated in the import system since Python 3.3 with PEP 420, under the name of namespace package.
Today I’d like to go a bit more in details about this.
If you have done a bit of scripting in Bash, you may know that you can redirect the input and output of the commands to other commands or files. This article introduces the basic of I/O redirections and explains some of the syntax that may seems cryptic at first.
When working around APIs, whether it is building or playing with, you often end up making API requests over and over that all look alike, and yet there are some stuff that you can’t remember. Like how would you provide form data with cURL? Or basic authentication with requests
? This article serves as a cheatsheet on all those common stuff.
__path__
attributeRecently, when preparing an article about Python import system, I discovered the __path__
attribute and found some cool stuff to do with it, so I wanted to show what I discovered.