How not to be slow using Python: Functions

People often ask me about improving the performance of their Python code. They even sometimes complain about Python being slow overall. This complaint often stems from the fact that people tend to use Python quite naively, without realizing the performance impact of certain constructs.

While optimization and performance tuning of existing code is important, there are some things to keep in mind while writing Python code. These things will let you avoid your code being unnecessarily slow in most cases.

In this post, we're going to take a bit of a dive, and look into how Python executes code; into functions and functional programming through the lens of performance.

Read more  ↩︎

New address (and setting up custom domain on GitLab pages)

I got a custom domain for my website: pawroman.dev

The .dev domains went live recently and are quite affordable. I like that Google decided to enforce HTTPS on every .dev website.

I managed to point my domain at GitLab pages hosted at gitlab.com. Read on for a quick guide.

Read more  ↩︎

Terminimal Zola theme

I have finally started my personal blog! Welcome.

I decided to go with Zola as the static website generator, mostly because it's very fast (written in Rust) and has a nice template language. Compared to Hugo I like it much better, and it's got most of the features I needed out of the box.

I have created a theme for the blog, called Terminimal. The theme is based on the Terminal theme by panr -- many thanks for that one, Radek!

If you like how this site looks, please check out my theme here.

Read more  ↩︎

Basic Python testing setup with pytest

Recently, pytest has become the de-facto standard Python testing framework. Compared to unittest or nose, pytest assumes a different philosophy. There's no more test cases, setUp/tearDown, specific asserts and all the boilerplate. pytest tries to keep things simple by using plain functions and make writing tests very straightforward.

I have been using pytest for a while now and I quite like it. I use it for all new projects. It's worth noting that it maintains compatibility with unittest and nose test suites which makes the migration easy -- I recommend giving it a go!

In this post, we'll take a look at how to get started with pytest in a Python project.

Read more  ↩︎