How to use mypy on Python 2.7 project

Posted on Fri, 29 Jul 2016 in Python • Tagged with python, mypy, type hinting

If you work on a big Python project, type hinting can help you to find many design and function usage problems. Of course, you have to use external tools for static analysis, such as mypy. This is a great tool, but supports Python 3 mainly. Support for 2.7 branch isn't so straightforward. There are a couple of tricks that allows you to use it for 2.7.


Continue reading

PyCon Russia 2016

Posted on Thu, 07 Jul 2016 in Python • Tagged with python, conference, pycon

PyConRu 2016 finished. It was the best PyConRu conference. Usually If there are two useful talks, conference is good. This time I found useful many amazing talks enough to fill an entire day-long session.


Continue reading

Build own iterator over enumerate

Posted on Mon, 27 Jun 2016 in Python • Tagged with python, iterators

Couple days ago one of my colleagues asked me to implement simple self-logging iterator inherited from enumerate. I tried to inherit directly from it and failed. I absolutely forgot how to use __new__ magic method. It was so embarrassing. I was in a hurry, so I promised myself to solve this puzzle. And I can tell you it is a simple task. Actually it takes 18 lines of code only.


Continue reading

My top 7 of PyCon 2016 videos

Posted on Tue, 14 Jun 2016 in Python • Tagged with pycon, python, conference

There is my list with 7 best PyCon 2016 videos. I don't say that other videos not good. I say that these videos are more useful for me or impress me more than others. And as you can see I prefer talks about Python internals. I hope you'll find this list helpful.


Continue reading

Mutable types as default params in Python

Posted on Thu, 09 Jun 2016 in Python • Tagged with Python, default params

Do you ask yourself why you souldn't use mutable types as default value for parameters in Python? I'm sure you ask at least if you are not a junior. Probably, your answer is "It causes to strange side effects". However, only a tiny part of python developers makes step throw and figure out how it works under the hood.


Continue reading

Kivy Project. Part 1. Setting up environment

Posted on Wed, 01 Jun 2016 in Python • Tagged with kivy, gui, python

Kivy is an interesting project that allows you build GUI applications for different platform including iOS and Android. If you believe the rumors... I decided to check out is Kivy suits to build for small python GUI app for 5 major platforms: Mac OS X, Linux, Windows, iOS, and Android. In this series I'll try to build a small app for learning foreign language vocabulary and deploy it on all these platforms.


Continue reading