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

9 Useful Articles about Asyncio

Posted on Fri, 20 Oct 2017 in Python • Tagged with python

asyncio is a useful library. However, it is not so easy to understand how to work with it. Documentation isn't enough. We need more examples. We need more explanations. The last couple of weekends I spent experimenting with this library. After that, I add some interesting articles into my Pocket. Here are some of them.


Continue reading

Python project integrity requires extra efforts

Posted on Fri, 06 Oct 2017 in Python • Tagged with python

Python is a very flexible programming language. Its dynamic nature allows programmers to code elegant solutions that almost impossible to make with other more strict languages, for example, Java. However, you have to pay for everything. While Python code base grows, it requires more and more efforts to keep project integrity. Without these extra efforts, the project will fall apart.


Continue reading

Hash function for function in Python

Posted on Mon, 11 Sep 2017 in Python • Tagged with python, cpython

A couple of weeks ago one of my colleagues ask if Python function is possible to use as a key in dicts? Yes, it is. So, every function has a hash. But how is it calculated? Based on function name? Based on function byte code? Actually, it calculates by transforming a pointer to a function object. However, it is not so easy to find it in the CPython code.


Continue reading

Success in Programming Book Review

Posted on Sun, 13 Aug 2017 in Reviews • Tagged with branding, book, industry

Personal branding isn't a thing that is discussed much in a programming world. Actually, I know very few guys who have strong personal brands and only two guys who can explain what personal branding is for software developers. One of them is Frederic Harper with his book “Success in Programming.”


Continue reading

Data Structures and Algorithms in Java (2nd Edition) Review

Posted on Fri, 23 Jun 2017 in Reviews • Tagged with java, lafore, algorithms

For me, the main advantage of "Data Structures and Algorithms in Java" is the language author uses to describe algorithms. He doesn't use overcomplicated academic language with tons of math. No. Robert uses plain English and tries to give an as simple explanation of an algorithm as possible.


Continue reading

Emacs hot-keys in non-English keyboard layout

Posted on Sat, 10 Jun 2017 in Editors & IDE • Tagged with emacs, layout

You are lucky if you need to use standard English keyboard layout only. I use Russian layout as often as English one. Everywhere hot-keys work OK, except Emacs. Maybe because it has an ASCII-is-enough-for-everybody legacy or other reasons, Emacs uses own weird way to switch layouts (or Input Method in Emacs terms): C-\. Instead of using that "standard" way I found another option.


Continue reading

Property in Child Class

Posted on Tue, 30 May 2017 in Python • Tagged with python, property

It looks obvious that you can override the property in a child class, and call "super" within it. Sounds OK? Yes, it is. However, when my colleague asked me about this behavior, I was confused. Maybe because I am a bit suspicious, every time I saw a magic thing of any kind in a code I expect a trap. What's why I decided to write a simple example to prove myself that it works as it should.


Continue reading

Pyenv on Mac

Posted on Fri, 19 May 2017 in Python • Tagged with python, pyenv

It can be painful to manage several Python versions on one laptop. However, it is a very common situation. Usually, developers have many projects that require different Python versions. There are a couple of variants to deal with it. My favourite is pyenv with virtualenv plugin. I used to use Homebrew itself to do that, but it wasn't so flexible.


Continue reading

Big Data. Educational Resources

Posted on Fri, 28 Apr 2017 in Other • Tagged with big data, coursera, quora, education

Big Data is a kind of buzzword nowadays. However, it looks that having skills in it can make a huge influence on a programming career. At least, it's true for me. That's why this list appears. It's a unsorted and unfiltered bunch of resources covered "Big Data" topic.


Continue reading