Swap Two Python Variables Without Using a Third One
With this neat little trick, you can swap two Python variables without using a third variable: It’s just one line of code! As you can … read more
With this neat little trick, you can swap two Python variables without using a third variable: It’s just one line of code! As you can … read more
A Python data class is a regular Python class that has the @dataclass decorator. It is specifically created to hold data. Since Python version 3.7, … read more
With Python, we can return multiple values at once. Obviously, most functions in Python return a single value, usually the result of the work done … read more
With sys.getsizeof() you can check the memory usage of an object. To do so, first import the module sys: Woah… wait… why is this huge … read more
IPython is an enhanced Python REPL, and it’s actually the core for Jupyter notebook. In short, Jupyter is an open-source web application that allows you to … read more
You can check for the Python version in your code, to make sure your users are not running your script with an incompatible version. All … read more