Managing Gigabytes of Images with git-annex

Earlier this year, I hit GitLab's 10GB storage limit with one of my git repositories. I'm writing a family blog where I document our various trips and activities, hoping that in 20 years, it will be a great memento (like a photo album combined with a journal in a digital form, wi … | Continue reading


@switowski.com | 2 months ago

No "Hello", No "Quick Call", and no Meetings Without an Agenda

Hi, You probably received a link to this website because you did one of the common mistakes of working remotely: You started a conversation by writing "Hi", or "Hello", or even maybe "Good morning Sebastian, I have a question". And then you waited. And waited. And waited for minu … | Continue reading


@switowski.com | 3 months ago

How to Enjoy Your Next Conference Better

Sometimes, when I go to a conference and mingle with people during lunch or a social event, I see someone sitting alone, looking at their phone, and not talking to anyone. At one social dinner, I saw a guy who spent one hour drinking two beers (everyone got them for free), ate so … | Continue reading


@switowski.com | 4 months ago

A Beginner's Guide to Continuous Integration in Python

Imagine this: you're working on a Python project, and you're annoyed that each time you create a new merge (or pull) request, you must remember to run tests. Or maybe you configured your code editor to run black each time you save a file, but your colleagues didn't. Every time yo … | Continue reading


@switowski.com | 4 months ago

pre-commit vs. CI

There is one question I get asked when people sit down to automate some checks in their project for the first time: Should I use pre-commit? Or should I set up a Continuous Integration in my GitLab/GitHub repository? The answer is "yes". You should use one or the other. Or even b … | Continue reading


@switowski.com | 5 months ago

Should I Have a Blog?

Yes. Or did you expect a different answer? You came to a blog to read an article on whether you should have a blog. Did you really think, even for a split second, the answer would be, "No, you shouldn't. And thinking about it, I'm closing my blog too. Sayōnara!" Blogs are great. … | Continue reading


@switowski.com | 5 months ago

Dear Conference Organizer

Dear Conference Organizer, First of all, thank you for all the hard work! Most Python conference organizers I know don't get paid for their work. Yet, they pour countless hours into helping people spread knowledge and bringing the community together every year. And just like open … | Continue reading


@switowski.com | 6 months ago

map() vs. List Comprehension

From For Loop vs. List Comprehension, we already know that list comprehension is usually faster than the equivalent for loop. In the article, I also compared list comprehension with the filter() function. I concluded that, while filter() has some justified use cases where it's be … | Continue reading


@switowski.com | 9 months ago

Inlining Functions

In this episode of Writing Faster Python, we will check if we can make the code faster by doing exactly the opposite of what every good programming book suggests – that is, keeping all the code in one, massive function instead of smaller, more manageable functions. Inlining a fun … | Continue reading


@switowski.com | 9 months ago

Pathlib for Path Manipulations

If I were to name my top ten modules from the standard library, pathlib would be high on that list. It could even make it to the top three. Manipulating paths was always a tricky problem if your code was supposed to work on different operating systems. If you accidentally hardcod … | Continue reading


@switowski.com | 9 months ago

How to Make a Great Conference Talk

Last year, I participated in a workshop organized by the EuroPython conference for beginner speakers where I shared my tips for making good presentations. It was a great idea, and I wish I had access to such a workshop when preparing my first talks. I have decided to write this g … | Continue reading


@switowski.com | 1 year ago

String Formatting

One of the most well-received features introduced in Python 3.6 were the f-strings. Unlike the walrus operator (introduced in Python 3.8), f-strings quickly became popular - it's hard to find someone who doesn't love them! Officially named literal string interpolation, f-strings … | Continue reading


@switowski.com | 1 year ago

Compare to None

How do we check if something is None? With the beauty of the Python language - the code that you would write is literally the same as the above question: if something is None: It reminds me of this joke: - How do you turn pseudocode into Python? - You add .py at the end of the fi … | Continue reading


@switowski.com | 1 year ago

WTF Excel?!

Some time ago, I was working on a simple tool to export data from our internal system to Excel files and allow users to import Excel files back. Sometimes the only way to convince seasoned Excel users to use your system is to give them a tool that facilitates the transition to th … | Continue reading


@switowski.com | 1 year ago

Dictionary Comprehension

Apart from the list comprehension method, in Python, we also have dictionary comprehension - a little less known but very useful feature. It's a perfect tool for creating a dictionary from an iterable. Let's see how we can use it and if it's faster than other methods. About the " … | Continue reading


@switowski.com | 1 year ago

How I Organize My Notes With Obsidian

A few months ago, I moved from Evernote to Obsidian. I have been using Evernote for as long as I can remember. And every now and then, I checked some alternative solutions. I tried Notion, but its first version was excruciatingly slow on mobile (waiting for 10+ seconds each time … | Continue reading


@switowski.com | 1 year ago

dict() vs. {}

There are two different ways to create a dictionary. You can call the dict() function or use the literal syntax: {}. And in many cases, these are equivalent choices, so you might give it little thought and assume they both take the same amount of time. But they don't! Starting wi … | Continue reading


@switowski.com | 1 year ago

How to Benchmark (Python) Code

While preparing to write the Writing Faster Python series, the first problem I faced was "How do I benchmark a piece of code in an objective yet uncomplicated way". I could run python -m timeit , which is probably the simplest way of measuring how long it takes to execute some co … | Continue reading


@switowski.com | 1 year ago

Upgrade Your Python Version

Here is an idea for a completely free[1] speed improvement for your code - upgrade your Python version! I started this series of articles using Python 3.8, but today we already have version 3.11. Python 3.11 is the first version of Python that brings pretty significant speed impr … | Continue reading


@switowski.com | 1 year ago

Add Comments To Your Commands

A quick tip: when you write an important command in shell, put a comment next to it so you can easily find it later or remember what it does: pytest -m slow --durations=10 # Run slow tests, return the slowest Why? # Source: https://www.commitstrip.com/en/2017/02/28/definite … | Continue reading


@switowski.com | 1 year ago

New Blog, Who Dis?

There is an unwritten rule that when you get back to your old blog, you have to rewrite it. You can't just continue. You won't be happy with what you wrote a year ago. The world is a different place now, there are 12361293 new JavaScript frameworks since the last time you chose o … | Continue reading


@switowski.com | 1 year ago

Python Versions Management With pyenv

Using the latest version of Python is always a good idea. First of all - you get the new features like the f-strings (Python 3.6), ordered dictionaries (officially guaranteed from Python 3.7, but already present in Python 3.6), or the union operator (Python 3.9). But even if you … | Continue reading


@switowski.com | 3 years ago

25 IPython Tips for Your Next Advent of Code

I've decided to skip last year's Advent of Code edition. Mostly because I didn't have time, but I also knew that I probably wouldn't finish it. I've never finished any edition. I'm not very good at code katas, and I usually try to brute force them. With AoC, that works for the fi … | Continue reading


@switowski.com | 3 years ago

Remove Duplicates From a List

How do we remove duplicates from a list? One way is to go through the original list, pick up unique values, and append them to a new list. About the "Writing Faster Python" series # "Writing Faster Python" is a series of short articles discussing how to solve some common problems … | Continue reading


@switowski.com | 3 years ago

type() vs. isinstance()

Python is a dynamically typed language. A variable, initially created as a string, can be later reassigned to an integer or a float. And the interpreter won't complain: name = "Sebastian"# Dynamically typed language lets you do this:name = 42name = Nonename = Exception() It's qui … | Continue reading


@switowski.com | 3 years ago

Membership Testing

Membership testing means checking if a collection of items (a list, a set, a dictionary, etc.) contains a specific item. For example, checking if a list of even numbers contains number 42. It's a quite common operation, so let's see how to do it properly. About the "Writing Faste … | Continue reading


@switowski.com | 3 years ago

Checking for True or False in Python

How can we compare a variable to True or False, what’s the difference between “is” and “==” operators, and what are truthy values? | Continue reading


@switowski.com | 3 years ago

Checking for True or False

How do you check if something is True in Python? There are three ways: One "bad" way: if variable == True: Another "bad" way: if variable is True: And the good way, recommended even in the Programming Recommendations of PEP8: if variable: The "bad" ways are not only frowned upon … | Continue reading


@switowski.com | 3 years ago

Sorting Lists

There are at least two common ways to sort lists in Python: With sorted function that returns a new list With list.sort method that modifies list in place Which one is faster? Let's find out! sorted() vs list.sort() # I will start with a list of 1 000 000 randomly shuffled intege … | Continue reading


@switowski.com | 3 years ago

For Loop vs. List Comprehension

Many simple "for loops" in Python can be replaced with list comprehensions. You can often hear that list comprehension is "more Pythonic" (almost as if there was a scale for comparing how Pythonic something is ). In this article, I will compare their performance and discuss when … | Continue reading


@switowski.com | 3 years ago

Ordered Dictionaries

If you worked with Python 2 or an early version of Python 3, you probably remember that, in the past, dictionaries were not ordered. If you wanted to have a dictionary that preserved the insertion order, the go-to solution was to use OrderedDict from the collections module. In Py … | Continue reading


@switowski.com | 3 years ago

Easy Speedup Wins With Numba

If you have functions that do a lot of mathematical operations, use NumPy or rely heavily on loops, then there is a way to speed them up significantly with one line of code. Ok, two lines if you count the import. Numba and the @jit decorator # Meet Numba and its @jit decorator. I … | Continue reading


@switowski.com | 3 years ago

Find Item in a List

Find a number # If you want to find the first number that matches some criteria, what do you do? The easiest way is to write a loop that checks numbers one by one and returns when it finds the correct one. Let's say we want to get the first number divided by 42 and 43 (that's 180 … | Continue reading


@switowski.com | 3 years ago

Ask for Forgiveness or Look Before You Leap in Python?

Is it faster to “ask for forgiveness” or “look before you leap” in Python? And when it’s better to use one over the other? | Continue reading


@switowski.com | 3 years ago

Ask for Forgiveness or Look Before You Leap?

"Ask for forgiveness" and "look before you leap" (sometimes also called "ask for permission") are two opposite approaches to writing code. If you "look before you leap", you first check if everything is set correctly, then you perform an action. For example, you want to read text … | Continue reading


@switowski.com | 3 years ago

Writing Faster Python - Introduction

2022 Update: I started writing these articles in 2020 using Python 3.8 on a 2017 MacBook Pro with Intel CPU. In 2022, I switched to a new MacBook Pro with M1 CPU and decided to also switch to the latest Python 3.11 version as it offers some nice speed-up improvements. So all the … | Continue reading


@switowski.com | 3 years ago

Let's Write an IPython Extension the Hard Way

How a 5-minute hack for %reload function turned into a rabbit hole of different Python tools and techniques. | Continue reading


@switowski.com | 3 years ago

Let's Write an IPython Extension the Hard Way

I love IPython. I love using it, I love writing about it, I love taking pictures with its core contributors (Hi Paul!). If I ever get invited to the "Talk Python To Me" podcast (not that I have anything interesting to talk about), and Michael Kennedy is going to ask me what my fa … | Continue reading


@switowski.com | 3 years ago

Favorite CLI Tools

26 CLI tools that I love. And one that is OK. | Continue reading


@switowski.com | 3 years ago

My Favorite CLI Tools

Previously, I wrote about my favorite Mac apps. But I spend half of my time in the terminal, and I have a handful of CLI tools that makes my life easier. Here are some of them: This is a long list, so here is a table of content with tl;dr summaries: fish shell - easy to use, begi … | Continue reading


@switowski.com | 3 years ago

VS Code Plugins That I Use for Writing Python

List of my favorite VS Code plugins that helps me build Python application. | Continue reading


@switowski.com | 4 years ago

18 Plugins for Writing Python in VS Code

VS Code is a great text editor. But when you install it, its functionality is limited. You can edit JavaScript and TypeScript, but for other programming languages, it will be just a text editor. You will need to add some plugins to turn it into a proper IDE. Luckily, when you ope … | Continue reading


@switowski.com | 4 years ago

I'm Programming on a Macbook and Here Are the Tools That Make My Life Easier

I’m programming on a Macbook, and I love it. Here are some of the tools that makes my life easier. | Continue reading


@switowski.com | 4 years ago

My Favorite Macbook Tools

I could spend days just tweaking things on my computer. Actually, I do. Whenever I see something annoying, I want to drop everything and try to fix it right away. It can be anything. From a minor: "Hey, I just run the same command twice, I should create an alias!" to installing r … | Continue reading


@switowski.com | 4 years ago

Of Debugging with IPython

Tips and tricks on how to use IPython as your debugger. | Continue reading


@switowski.com | 4 years ago

5 Ways of Debugging with IPython

There is a great article from Tenderlove - one of the core Ruby and Rails developers - called "I am a puts debuggerer", that I enjoyed when I played with Ruby. The gist of it is to show you that, in many cases, you don't need a full-fledged debugger. Don't get me (or Tenderlove) … | Continue reading


@switowski.com | 4 years ago

Disable pip Outside of Virtual Environments

Python packages everywhere # I'm a huge fan of virtual environments in Python. They are a convenient way to manage dependencies if you are working on more than one Python project at a time. Well, they are the only way to manage dependencies between projects. In the JavaScript wor … | Continue reading


@switowski.com | 4 years ago

How to Prepare for the CAPM Certification Exam

"Wait, aren't you a software developer?" If it's not your first time on my blog, you might be thinking: "Aren't you a prominent software developer, not a project manager?" Ok, maybe without the prominent part. But yes, you are right. I started working as a developer a few years a … | Continue reading


@switowski.com | 4 years ago