Using import foo.bar.baz as fbb

Posted on Mon, 18 Mar 2019 in Python • Tagged with python

There is a wonderful feature in Python import statement to make an alias for an imported object (import foo.bar.baz as fbb). It allows to avoid name conflicts and improve code readability if necessary. And of course, using it you can easily turn your perfect code into a completely unreadable mess. Recently I’ve seen this several times. I’ve met some strange abbreviations and confusing aliases.


Continue reading

Please Do Not Use "else"

Posted on Tue, 29 Jan 2019 in Python • Tagged with python

I don’t like else if there is return-statement in both branches. It is always possible to write code without that unnecessary if appendage. Such code looks more accurate, more clear and it is easier to read. Why so many developers still use this useless else?


Continue reading

Plans for 2019

Posted on Wed, 02 Jan 2019 in Other • Tagged with blog, plans, 2019

Today is 2nd of January 2019. It is a time to make some plans for this blog. I want to write at least 12 blog posts. There are two topics that I find very interesting: CodinGames and Kaggle challenges.


Continue reading

Mobile App with Kivy and Python? Mmm… Not now

Posted on Thu, 25 Oct 2018 in Python • Tagged with python, kivy, mobile

There are several GUI frameworks for Python. Most of them are for desktop applications. Kivy is an exception. Using it you can build project for mobile platforms. Unfortunately, it is not production ready. You have to juggle versions of libraries to make it works. So even having a t-shirt that says print("Python is my favorite language") I have to accept that Python is not for mobile development.


Continue reading

Optional or Not in Abstract Classes

Posted on Mon, 27 Aug 2018 in Python • Tagged with python, type hints

Type hints are not mandatory in Python. So you can use them or not. If you decide work with them you’ll face many difficulties annotating functions or variables. This article shows my point of view on one specific case.


Continue reading

Coders Strike Back Post-mortem

Posted on Thu, 12 Jul 2018 in Other • Tagged with python, c++

The latest couple of months I've spent around 40 hours at weekends and in evenings trying to write a bot that is able to finish the track of Coders Strike Back faster than opponents. During this time I'd made quite a lot of mistakes before I got into the Legendary league. This is a post-mortem for that project.


Continue reading

4 Articles about Python Internals

Posted on Thu, 29 Mar 2018 in Python • Tagged with python, python internals, cpython

Maybe, knowing Python internals is not a thing you should know to be a good Python developer. However, if you want to improve your code it becomes more important. If you know it works under the hood, you write a code with less stupid mistakes and architecture issues.


Continue reading

Computer Science Distilled

Posted on Wed, 28 Feb 2018 in Reviews • Tagged with books

Are you looking for a simple thin Computer Science book? Maybe, Computer Science Distilled is for you. Unfortunately only if you have no plans to code for living. In this case, it is a good introduction to computer science world. If you are professional developer or CS student, skip this book.


Continue reading

Tuple[Callable, Any, ...]

Posted on Mon, 29 Jan 2018 in Python • Tagged with typing, mypy, python

Type hints could help you a lot with a big Python project. However, they sometimes require code refactoring. I wrote about it last year in this article, but I have found a good example for this only now.


Continue reading

How to add type hints into Python 2.7 project

Posted on Mon, 11 Dec 2017 in Python • Tagged with typing, mypy, python

Many times I wrote that type hints in Python help to work with big or moderate projects. However, if you decide to add them to your project, you have to check your project regularly using CI. And this kind of checks is not easy to implement. This article is my story about obstacles in this process.

I'm trying to add type hints to our project for a while. And now I have a bunch of methods how to do it more efficiently, fast, and painless. I spend many days trying to find them. Now I want to share my experience.


Continue reading