Skip to main content

Posts

Showing posts from August, 2015

Mobile accessories review

As some of you know, I'm a happy owner of Huawei Mediapad X1. So far it's the best 7" phablet (not counting the new Mediapad X2, obviously, which has better hardware with the same size and slightly changed buttons) but this post is not about device itself, instead I wanted to write a few words about cables, cases, screen protectors available on the market. By "market" I usually mean Aliexpress but some stuff might be available in your local stores as well. I'm not endorsing any sellers or brands, especially not original accessories, and prices are for reference only (and usually are for one piece and include shipping i.e. if you're thinking to buy a dozen of something, you might be able to find a better deal). In almost all the cases there might be cheaper options but with worse quality, seasonal deals and everything tend to change every month as new manufacturers and sellers come to market. Unlike competitors' devices in the same form factor (I'

Settling the bracket discussion once and for all

There are quite a few ways you can format a multi-line function call/list/dictionary in a programming language. With Python (at least with PEP8) it's just two ways: hanging indentation and vertical indentation. The latter is quite straight-forward and I mention it in the notes below. The former one is what this post is about. Well, about a minor but important question of where to place the closing bracket when using it. Yes, style is much more than formatting the commas and brackets so let's settle this and move on to the more important questions. When using hanging indentation, the only true way is this one(*): some_tuple = ( # Nothing here, only opening bracket. item1, item2, item3, item4, # Several items on one line is acceptable though not recommended. item5, # Last comma is important. And never, never place the closing bracket here. ) # Again, nothing here but the bracket and it's on the same level as the opening line. Empty line after the o