Blogs

Category: none



Python __subclasses__ hook

28 Aug 2016    Python

As learning of Python goes deeper and deeper, more and more special hooks are being discovered and I realize that quite some tasks could be done in different ways.

精选的25道Python面试题和答案

21 Aug 2016    Python

Translation of an English article, the original link is Article Link

Become a sublime power user

07 Aug 2016    sublime

Sublime is a great text editor. It is fast and extensible and it looks nice as well. It is really hard to argue that it is the best editor. In fact, although I am a fan a Sublime text editor, I would not say that it is faster than Vim in terms of editing if you are really familiar. But I would claim that if you are really good at one, the editing experience would be equally awesome for Vim or Sublime. I have not used Atom or Emacs much so I would not compare those two and others such as Notepad++ or TextMate.

Understand web server concurrency models with examples in Python

27 Jul 2016    Python

In this post we will explore single linear process, multi-processing and multi-threading and epoll as different models for web server concurrency in Python.

Notes after reading a level-up book about Python -- how to be more Pythonic, elegant and effective

15 Jul 2016    Python

Python is elegant and expressive and there is not much needed to prove this. Simply open up a terminal and get started with its English-like syntax and solve hard and tricky problems in shorter and more beautiful code. I have been learning and using Python for quite some time and find that I need to know more in-depth knowledge. A lot of the time I just find the language so easy to use that I may just stop there without ever digging into it. By thinking about how to further improve it, in terms of extensibility or performance, I am pushing myself to become a better Pythonic programmer.

Make your Linux terminal visually appealing

10 Jul 2016    Linux

Linux has been capturing a larger market share with its heavy use in servers and the increasing trend of cloud infrastructure. As a developer, as long as your are tied tightly to Windows technology stack, you may probably go for Mac or some Linux machine (Windows is transforming and embracing Linux as well–we see more open source effortS like .Net for Linux, .Net core open source and bash for Windows and support for Ubuntu in Windows 10 natively). Mac is based on BSD and its user-interface design is pretty good already (you can argue it is the best). However, even for the most popular Linux distribution Ubuntu, the UI… Well, guess most of the users of Linux systems so far are still programmers and we should care less about the look? I beg to differ as a programmer. For terminals, I guess properly and constantly color-coded display is definitely better than a huge chunk of white characters piled together on top of some black background.

Properly reraise exception in Python (2 and 3)

30 Jun 2016    Python

Exceptions are a elegant and effective way to signal errors in programming for callers to deal with. As a good programming language, Python supports exceptions pretty well. However, there is one special case that requires attention when dealing with exceptions: what if I caught an exception, but instead of simply raise it, I want to wrap it in another class of exception without losing the stack trace of the original exception?