Want to add type annotation to a variable? Do refactoring!

Posted on Thu, 06 Oct 2016 in Python • Tagged with python, type hinting

There is the PEP 526 implemented in Python 3.6 that adds optional type annotations for variables. It's replacement for type comments. There is one pitfall: adding type annotations for local variables can hide problems with code.

Continue reading

Don't use dicts so much

Posted on Fri, 09 Sep 2016 in Python • Tagged with python, dict, rest

Python developers tend to use dicts too much. Mainly I tell about pass data through application as dicts not objects. It's a bad design witch causes many problems.

Continue reading

Move from Python to Java. First impressions

Posted on Fri, 26 Aug 2016 in Java • Tagged with java, python, spring

I've added Java to my technology stack at work recently. We decided to do our new project using Spring Framework. For me it is a very interesting challenge, cause I've used Java only in my pet projects before. There are my very first impressions.

Continue reading

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