Recent posts

Demystifying python container types

11 minute read

Writing type annotations in python can be hard. How do I pick the right one with so many different options that look so similar? If a function returns [1, 2, 3], how should I annotate it? Should it be an Iterable, or a MutableSequence? Can it be a Generator? And why not just a list? The short answer is, as always, “it depends”, on what exactly you want to do. Let’s go through some of the python types related to container of elements, discuss how those are related, and where to use them.

Sorry, I still don’t understand what type variance is

12 minute read

I enjoy static typing and use it at work and for personal projects. It makes my life easier, but sometimes the errors that my type checker produces confuse me. For example, I have heard of type covariance and contravariance, but I still can’t quite follow when and why should I care about that? In this post we discuss a couple of realistic scenarios that lead us to the ideas of type variance.

Some lessons from my Ph.D.

6 minute read

I want to share some general ideas that will make your PhD journey more enjoyable, less stressful, and much more productive. In my experience, most of the tips are useful beyond your college years: I still follow them, so practicing them during 3 - 4 years of a PhD can benefit you in the next steps in your career. These ideas won’t work unless they become a habit, but I believe that it is worthwhile trying them out and adjusting to your own needs.

The Lord of the Coins: The Two Towers

9 minute read

Recently there was an interesting puzzle posted on the ODS Slack channel. An ancient evil dragon captures Alice and Bob and puts them in two different towers. The dragon tosses a fair coin infinitely many times for Alice, and then does the same for Bob. The adventures should each name a number, and the dragon checks the coin toss outcome of the Alice’s infinite sequence at the position number, named by Bob, and then the coin toss outcome of the Bob’s sequence at the position number, named by Alice. If the outcomes are the same, our heroes are free. Wh...